Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: FlexFormToolsArrayValueByPathRector modifies FlexFormTools::cleanFlexFormXML() with non-working code #4279

Closed
sypets opened this issue Jun 19, 2024 · 0 comments · Fixed by #4280
Labels

Comments

@sypets
Copy link

sypets commented Jun 19, 2024

Minimal PHP Code Causing Issue

in TYPO3 extension Upgrade Wizard:

protected function cleanupXmlArray(array $row): array
{
        $this->flexformTools->cleanFlexFormXML('tt_content', 'pi_flexform', $row);
        $xmlArray = $this->flexformTools->cleanFlexFormXML;
        return $xmlArray;
}

Applied rules

FlexFormToolsArrayValueByPathRector

with changelog: https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/11.5/Deprecation-95254-TwoFlexFormToolsMethods.html

The code is changed like this:

 protected function cleanupXmlArray(array $row): array
 {
-        $this->flexformTools->cleanFlexFormXML('tt_content', 'pi_flexform', $row);
+        $dataArray = \TYPO3\CMS\Core\Utility\ArrayUtility::setValueByPath('pi_flexform', 'tt_content', $row);
         $xmlArray = $this->flexformTools->cleanFlexFormXML;
         return $xmlArray;
 }

Expected Behaviour

I think rector should (if in doubt) skip this code. cleanFlexFormXML is AFAIK not deprecated yet. Also, the change in code is not as intended:

  • FlexFormTools::cleanFlexFormXML() sets $this->cleanFlexFormXML
  • the array function and result $dataArray assigned, but not used
  • $this->flexformTools->cleanFlexFormXML is returned (which is not initialized)
  • not sure if Flexform is cleaned as intended

Package Version

2.6.0

PHP Version

8.2.20

TYPO3 Version

11.5.38

Notes

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant