-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix non-numeric value warning #627
Conversation
Fixes this warning on generating PDF: Warning: A non-numeric value encountered in /tcpdf/tcpdf.php on line 5473
tcpdf.php
Outdated
if(!is_numeric($this->textstrokewidth)){ | ||
$this->textstrokewidth = 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you try to track in the code where it changes to a non numeric value ?
/**
* Text stroke width in doc units.
* @protected
* @since 4.9.008 (2010-04-03)
*/
protected $textstrokewidth = 0;
Since it's initialized to 0
Maybe you can add an @var int
or @var float
or @var int|float
phpdoc on this property, for documentation purposes
The fix you propose indeed should work, but if we can catch it earlier to avoid the textstrokewidth
being a non numeric that would be cool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, turns out I was passing a non-numeric value to the Text
function for $fstroke
. The new commit ignores non-numeric values that are passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, it looks way better
Is this mistake related to your code of tcpdf code calling the function ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess so, but anybody calling $pdf->Text($x, $y, $text, "non-numeric");
would get the same warning
Fixes this warning on generating PDF after calling `Text` with a non-numeric value for `$fstroke`: Warning: A non-numeric value encountered in /tcpdf/tcpdf.php on line 5470
Co-authored-by: William Desportes <williamdes@wdes.fr>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's hope Nicolas also likes this patch
Fixes this warning on generating PDF:
Warning: A non-numeric value encountered in /tcpdf/tcpdf.php on line 5473