php-svg-lib
php-svg-lib copied to clipboard
Incorrect assignment in if statement
Version 0.3.4
I found the following using a code scan:
if ($stroke = $style->stroke && is_array($style->stroke)) {
This is in SurfacePDFLib.php
This is equivalent to the following because assignment happens after the Boolean &&.
if ($stroke = ($style->stroke && is_array($style->stroke))) {
I just want to make sure that this isn't a problem in some way, because this mistake is common. If wrong, it would be fixed by
if (($stroke = $style->stroke) && is_array($style->stroke)) {
or by using and instead of &&.
Another occurrence in the same file:
if ($fill = $style->fill && is_array($style->fill)) {
Previously posted issue: https://github.com/dompdf/dompdf/issues/2113
Probably a mistake. The logic in the other two adapters is slightly different.