-
Notifications
You must be signed in to change notification settings - Fork 7.8k
sqlite3_bind_bug68849 fail on x86 with sqlite 3.43 #12076
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
Comments
Confirm it fails on 8.1.22 too when sqlite3 is 3.43.0 |
I did a little research on this issue.
Among these, only "2" is reproduced, however, a little more research revealed something strange. From this it at least appears that the problem is occurring with writes rather than reads. |
I tried following these steps: 32bit Alpine, Sqlite3.43 Create a table from php and insert it:
Insert directly from sqlite:
Check the data from sqlite:
Check data from php:
I currently have no idea why this is happening. |
Oops.....
write.rb
write.php
result:
|
One more mysterious detail - it fails only on x86 32-bits, on armv7 and armhf arches (32-bits too) it passed( |
Using a prepared statement and binding the value gives us 3.14. Maybe there is something wrong with the zval string? I haven't done any research yet, so I'm guessing... |
Apparently ruby uses prepared statements inside execute. It was a bit premature to assume that php was the cause. Looks like I need to investigate a little more carefully. |
I might have gotten some hints. When passing a value as a string:
When passing a value as a float:
|
So default is |
I feel that way too. However, unless you establish a reproduction procedure that excludes PHP or identify the source code that is causing the problem, it will be difficult to get the SQLite side to acknowledge the problem. So we need to somehow establish a reproducible procedure. |
I currently have no idea why this is happening..... php:
ruby:
python:
cli:
At least in this case, only php has broken results. |
I wrote C and tried inserting it so that the conditions are almost the same as when using php's sqlite3.
php read result:
|
I understand the cause. Line 356 in e2189e5
The Linux default should be 64bit, but it seems that 53bit is set in the environment like this in the startup of php. Changing to a 64-bit system would certainly solve the problem, but I'm worried about the impact on other parts. Since the default value of windows seems to be 53bit, it may be necessary to increase the number of conditional branches of the preprocessor in some cases. |
First of all, I reported this problem and the cause to the sqlite side. Regarding the response on the php side, it seems better to wait for their response first and then discuss it. |
I've been asking a lot of questions on the Sqlite forum.
I think it's a bit unreasonable to change the precision of double in patch versions. |
After upgrade to sqlite 3.44.0 another test started to fail #12633 TEST 12220/16282 [ext/sqlite3/tests/sqlite3_defensive.phpt]
========DIFF========
bool(true)
003+ int(0)
int(1)
004- int(1)
Warning: SQLite3::querySingle(): Unable to prepare statement: 1, table sqlite_master may not be modified in %s on line %d
bool(false) |
PHP unit tests are broken with SQLite >= 3.43 [1]. If I understand the discussion in the SQLite forums [2] on the issue correctly, the trigger for this should not be a problem with SQLite itself but the test itself (and thus using a current SQLite version shouldn't generally be a problem for actual PHP code). [1]: php/php-src#12076 [2]: https://www.sqlite.org/forum/forumpost/abbb95376ec6cd5f
PHP unit tests are broken with SQLite >= 3.43 [1]. If I understand the discussion in the SQLite forums [2] on the issue correctly, the trigger for this should not be a problem with SQLite itself but the test itself (and thus using a current SQLite version shouldn't generally be a problem for actual PHP code). [1]: php/php-src#12076 [2]: https://www.sqlite.org/forum/forumpost/abbb95376ec6cd5f (cherry picked from commit fb1cc4a)
Description
The test
ext/sqlite3/tests/sqlite3_bind_bug68849.phpt
fail on x86 arch (32-bits)Previous build (8.2.10RC1) passed but sqlite was 3.42.0 (current is 3.43.0)
The same test failed building PHP 8.3RC1 so very probably precision somehow affected
Refs
PHP Version
PHP 8.1.22, 8.2.9, 8.3.0RC1
Operating System
Alpinelinux
The text was updated successfully, but these errors were encountered: