WordPress/wordpress-playground

PHP warnings from SQLite integration

swissspidy opened this issue · 4 comments

Not sure if this is better reported here or https://github.com/WordPress/sqlite-database-integration, I hope someone else knows.

I am getting this PHP warning (twice) when opening the block editor:

Warning: strtotime(): Epoch doesn't fit in a PHP integer in /wordpress/wp-content/plugins/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-translator.php on line 40

strtotime returns an integer of size_t which is 32bit in wasm and therefore cannot contain values larger than max int 32. I tried updating the type to uint64_t and it still didn't work because even if the C function returns the correct integer, Zend engine will then make it 32bit.

Maybe we could globally set size_t to 64 bits, but I'd rather not. Let's try to unregister PHP's strtotime instead, and provide an alternative implementation.

Fixed in WordPress/sqlite-database-integration#28 – I found a way to prevent running strtotime() with a date that would yield a timestamp outside of the supported 32bit integer range

If this issue ever comes back because there's a need to support dates after 2038, here's an attempt to make strtotime() return a float instead of an int so that it can represent a larger range of numbers: #181

I just saw another instance of this with:

CleanShot 2023-10-13 at 15 13 11@2x

Workaround merged in #1014. This particular issue won't be resolved until we can compile PHP as a 64bit assembly as these timestamps are larger than 32 bit integers.