sabbelasichon / typo3-rector

Rector for TYPO3
MIT License
215 stars 60 forks source link

SubstituteConstantsModeAndRequestTypeRector does wrong convertion #4216

Open simonschaufi opened 2 months ago

simonschaufi commented 2 months ago

Bug Report

Minimal PHP Code Causing Issue

-        if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_FE)) {
+        if (!(TYPO3_REQUESTTYPE & ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend())) {
             return null;
         }

Expected Behaviour

-        if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_FE)) {
+        if (!(ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend())) {
             return null;
         }
sabbelasichon commented 2 months ago

I am not quite sure. I think there is no substitution for the constant TYPO3_REQUESTTYPE. Have a look at https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/11.0/Deprecation-92947-DeprecateTYPO3_MODEAndTYPO3_REQUESTTYPEConstants.html#php-typo3-mode-and-php-typo3-requesttype-in-file-ext-localconf-php-and-file-ext-tables-php-files

helsner commented 1 month ago

i merged my PR for this one https://github.com/sabbelasichon/typo3-rector/issues/4256 and found this issue afterwards maybe it is already patched with that?

helsner commented 1 month ago

just checked - it's not fixed with the other PR