dompdf / php-font-lib

A library to read, parse, export and make subsets of different types of font files.
GNU Lesser General Public License v2.1
1.73k stars 256 forks source link

strftime() usage #91

Closed PHPGangsta closed 2 years ago

PHPGangsta commented 3 years ago

https://github.com/PhenX/php-font-lib/blob/ca6ad461f032145fff5971b5985e5af9e7fa88d8/src/FontLib/BinaryStream.php#L285

strftime() is mentioned in an RFC to be deprecated in PHP 8.1 and removed in PHP 9 if the voting succeeds: https://wiki.php.net/rfc/deprecations_php_8_1

strftime() works differently depending on the operating system and the libc version. And it's not thread-safe, according to this discussion: https://externals.io/message/113657#114966

It looks like this strftime() usage does not use any locale-specific "format parameter strings". And I don't find any calls to setlocale() in the code of php-font-lib. But maybe I'm wrong.

If the output is not locale-specific, a simple date('Y-m-d H:i:s', $date); can also be used, or not? Or is there any edge-case that I'm missing?

bsweeney commented 2 years ago

Addressed by commit 12f5384a1e6c881415a195367c7dfbfc1b56b88d.