Closed pocketarc closed 8 years ago
I've had reports with a similar issue in https://github.com/barryvdh/laravel-dompdf/issues/190 on PHP 7.0.2
I've had another error where "strftime() expects parameter 2 to be long, string given", and I dug deeper to see what exactly the use of readLongDateTime() is. It seems like it's just used to set created/modified dates for fonts. So when things go wrong with reading the date, I've changed the code to just set the timestamp to 0 and move on. It doesn't affect anything negatively, and it stops warnings from showing up.
I still would like to dig deeper into this and figure out why exactly it's failing to read the dates, but that'll have to wait till I have a bit of free time.
if (is_string($date) || $date > PHP_INT_MAX || $date < PHP_INT_MIN) {
$date = 0;
}
When using DejaVu Sans in dompdf on a 32-bit system,
$this->readUInt32();
would often return values outside of the valid integer range, which would turn them into floats, whichstrftime
doesn't like. 64-bit systems don't have this problem.This code just overrides that for values outside of the valid integer range. It doesn't solve the problem, but readLongDateTime() seems like it has very little use and in these circumstances I'd rather it return an invalid date/time than throw a PHP error. Thoughts?