dompdf / php-svg-lib

SVG file parsing / rendering library
GNU Lesser General Public License v3.0
1.4k stars 77 forks source link

Incorrect assignment in if statement #56

Closed mbomb007 closed 2 years ago

mbomb007 commented 4 years ago

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

bsweeney commented 4 years ago

Probably a mistake. The logic in the other two adapters is slightly different.