Skip to content
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

PHP warnings from SQLite integration #159

Closed
swissspidy opened this issue Mar 18, 2023 · 4 comments
Closed

PHP warnings from SQLite integration #159

swissspidy opened this issue Mar 18, 2023 · 4 comments
Labels
[Aspect] Sqlite [Feature] PHP.wasm [Type] Bug An existing feature does not function as intended

Comments

@swissspidy
Copy link
Member

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
@adamziel
Copy link
Collaborator

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.

@adamziel
Copy link
Collaborator

adamziel commented Mar 27, 2023

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

@adamziel
Copy link
Collaborator

I just saw another instance of this with:

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

@adamziel adamziel reopened this Oct 13, 2023
@adamziel adamziel mentioned this issue Nov 22, 2023
11 tasks
@adamziel adamziel added [Type] Bug An existing feature does not function as intended [Feature] PHP.wasm [Aspect] Sqlite labels Nov 22, 2023
@adamziel
Copy link
Collaborator

adamziel commented Feb 8, 2024

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.

@adamziel adamziel closed this as not planned Won't fix, can't repro, duplicate, stale Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Aspect] Sqlite [Feature] PHP.wasm [Type] Bug An existing feature does not function as intended
Projects
None yet
2 participants