Skip to content

TypeError: Unsupported operand types: float + string in TCPDF->Write() (line 6442 ... tcpdf.php). #608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
arx-e opened this issue Apr 20, 2023 · 4 comments

Comments

@arx-e
Copy link

arx-e commented Apr 20, 2023

I was getting this error while using the library with Drupal module Views PDF 7.x-3.1 and TCPDF 6.6.2 (running php 8.0 or 8.1)
TypeError: Unsupported operand types: float + string in TCPDF->Write() (line 6442 of ... /tcpdf/tcpdf.php).

The issue has been solved by the following modification to line 6442 of tcpdf.php:
from this
$maxy = $this->y + $maxh - max($row_height, $h);
to this
$maxy = $this->y + (float)$maxh - max($row_height, $h);

Following this suggestion https://phpcod.com/fatal-error-uncaught-typeerror-unsupported-operand-types-string-float/

@talesvalente
Copy link

Same here

@williamdes
Copy link
Contributor

Does newer versions of TCPDF also have this issue ?
Any patch of pull-request to fix it is very welcome

@emerham
Copy link

emerham commented May 23, 2025

as of version 6.9.4 this is still an issue when using strict types.

@williamdes
Copy link
Contributor

as of version 6.9.4 this is still an issue when using strict types.

okay, can you provide a full TCPDF example ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants