- Issue created by @paucala
- last update
over 1 year ago 1 pass - @paucala opened merge request.
- Status changed to Needs review
over 1 year ago 1:43pm 15 June 2023
Running sonarqube we found this issue on ln 89 of ResponsiveBgImageFormatter.php: Make sure that the referenced value variable is unset after the loop.
Why is this a problem?
When a reference is used in a foreach loop instead of using a simple variable, the reference remains assigned and keeps its "value" which is a reference, even after the foreach execution. Most of the time, this is not what the developer is expecting and the reference may be used wrongly in the rest of the code. For this reason, it is recommended to always unset a reference that is used in a foreach to avoid any unexpected side effects.
The proposed solution is unset the referenced variable after the loop
Needs review
1.0
Code