Repository navigation
Fix large int corruption to/from pdo_sqlite UDF #25058
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||
| --TEST-- | ||||||
| GH-25021 UDF isn't using sqlite3_*_int64 API | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some names are formatted this way, some are not, why?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because people are inconsistent |
||||||
| --EXTENSIONS-- | ||||||
| pdo_sqlite | ||||||
| --FILE-- | ||||||
| <?php | ||||||
|
|
||||||
| $conn = new PDO('sqlite::memory:'); | ||||||
|
|
||||||
| $conn->sqliteCreateFunction('my_udf_pass_int', static fn(int $v): int => $v); | ||||||
|
|
||||||
| foreach ([ | ||||||
| 10, | ||||||
| PHP_INT_MIN, | ||||||
| PHP_INT_MAX, | ||||||
| ] as $v) { | ||||||
| $stmt = $conn->prepare('select my_udf_pass_int(:v)'); | ||||||
| $stmt->bindValue(':v', $v, PDO::PARAM_INT); | ||||||
| $stmt->execute(); | ||||||
| $result = $stmt->fetch(); | ||||||
|
|
||||||
| var_dump($result[0] === $v); | ||||||
| } | ||||||
| ?> | ||||||
| --EXPECT-- | ||||||
| bool(true) | ||||||
| bool(true) | ||||||
| bool(true) | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,27 @@ | ||||||
| --TEST-- | ||||||
| GH-25021 UDF isn't using sqlite3_*_int64 API | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| --EXTENSIONS-- | ||||||
| sqlite3 | ||||||
| --FILE-- | ||||||
| <?php | ||||||
|
|
||||||
| $conn = new SQLite3(':memory:'); | ||||||
|
|
||||||
| $conn->createFunction('my_udf_pass_int', static fn(int $v): int => $v); | ||||||
|
|
||||||
| foreach ([ | ||||||
| 10, | ||||||
| PHP_INT_MIN, | ||||||
| PHP_INT_MAX, | ||||||
| ] as $v) { | ||||||
| $stmt = $conn->prepare('select my_udf_pass_int(:v)'); | ||||||
| $stmt->bindValue(':v', $v, SQLITE3_INTEGER); | ||||||
| $result = $stmt->execute()->fetchArray(); | ||||||
|
|
||||||
| var_dump($result[0] === $v); | ||||||
| } | ||||||
| ?> | ||||||
| --EXPECT-- | ||||||
| bool(true) | ||||||
| bool(true) | ||||||
| bool(true) | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use
#ifdef ZEND_ENABLE_ZVAL_LONG64instead (below too)