Incorrect assignment in if statement
Closed this issue · 1 comments
mbomb007 commented
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: dompdf/dompdf#2113
bsweeney commented
Probably a mistake. The logic in the other two adapters is slightly different.