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: SubstituteMethodRmFromListOfGeneralUtilityRector #3940

Closed
franzholz opened this issue Dec 22, 2023 · 0 comments · Fixed by #3941
Closed

Bug: SubstituteMethodRmFromListOfGeneralUtilityRector #3940

franzholz opened this issue Dec 22, 2023 · 0 comments · Fixed by #3941
Assignees
Labels

Comments

@franzholz
Copy link

Rector 0.17.0
ssch/typo3-rector 1.5.2
Typo3 11LTS

The replacement for rmFromList is broken and leads to a wrong code with an undefined variable $element. It loses the real variable of the code.

example:

  1. Classes/View/PhpWord.php:230
    ---------- begin diff ----------
@@ @@
             }
             $document->setValue('billing_' . $field, $value);
             if (!empty($value)) {
-                $missingFields = GeneralUtility::rmFromList($field, $missingFields);
+                $missingFields = implode(',', array_filter(explode(',', $missingFields), function ($item) use ($element) {
+                    return $element == $item;
+                }));
             }
             //         debug ($missingFields, '$missingFields abgezogen');
         }
    ----------- end diff -----------

Applied rules:

It should have been like this instead:

+         $missingFields = implode(',', array_filter(explode(',', $missingFields), function ($item) use ($field) {
+             return $field == $item;
+         }));

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.

2 participants