safe icon indicating copy to clipboard operation
safe copied to clipboard

mktime (and gmmktime) may still return false in PHP 8+

Open jaydiablo opened this issue 3 years ago • 0 comments

In #385, mktime was deprecated in this lib, but technically I think mktime will still return false in an unusual situation:

https://github.com/php/php-src/blob/master/ext/date/php_date.c#L1156

Before digging into php-src to see if it would still return false I explored changing the stubs in phpstan (because with the change in #385 in place, I get phpstan errors about using deprecated functions, but if I remove use function Safe\mktime; then I get the possible false return type, which PHPStan catches in other places, like when passed to the date function).

https://github.com/phpstan/phpstan-src/pull/1768

While it does seem to be an unusual situation (I can't make it return false on 3v4l.org https://3v4l.org/SZSk4), it's still technically correct.

We have to pin this lib at 2.3.7 to avoid these phpstan errors, should mktime and gmmktime be "undeprecated"?

jaydiablo avatar Oct 13 '22 15:10 jaydiablo