tecnickcom / TCPDF

Official clone of PHP library to generate PDF documents and barcodes
https://tcpdf.org
Other
4.22k stars 1.52k forks source link

setHeaderData asks for string lw #413

Closed gemal closed 2 years ago

gemal commented 3 years ago

https://github.com/tecnickcom/TCPDF/blob/main/tcpdf.php#L3318

you have: @param string $lw header image logo width in mm

but: $lw=0

williamdes commented 3 years ago

Hi @gemal I do not understand where the problem is, could you explain further ?

gemal commented 3 years ago

the problem is that the docblock says that $lw is a string while it's being set to a int A tool like phpstan will complain about this

williamdes commented 3 years ago

the problem is that the docblock says that $lw is a string while it's being set to a int A tool like phpstan will complain about this

Oh snap, I missed that Added a commit for it #402

internalsystemerror commented 3 years ago

This is causing the following error since we started incorrectly using a string:

TypeError: Unsupported operand types: string * float in file /var/www/vendor/tecnickcom/tcpdf/tcpdf.php on line 3490
Stack trace:
  1. TypeError->() /var/www/vendor/tecnickcom/tcpdf/tcpdf.php:3490
  2. TCPDF->Header() /var/www/vendor/tecnickcom/tcpdf/tcpdf.php:3605
  3. TCPDF->setHeader() /var/www/vendor/tecnickcom/tcpdf/tcpdf.php:3272
  4. TCPDF->startPage() /var/www/vendor/tecnickcom/tcpdf/tcpdf.php:3184