Skip to content

Fix GH-9971: Incorrect NUMERIC value returned from PDO_Firebird #10021

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

Closed
wants to merge 1 commit into from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Nov 29, 2022

Dialect 1 databases store and transfer NUMERIC(15,2) values as doubles, which we need to cater to in firebird_stmt_get_col() to avoid ZEND_ASSUME(0) to ever be triggered, since that may result in undefined behavior.

Since adding a regression test would require to create a dialect 1 database, we go without it.


An alternative fix would be to drop the EMPTY_SWITCH_DEFAULT_CASE() altogether, and fix the unitialized var warning by initializing n to 0 instead.

Dialect 1 databases store and transfer `NUMERIC(15,2)` values as
doubles, which we need to cater to in `firebird_stmt_get_col()` to
avoid `ZEND_ASSUME(0)` to ever be triggered, since that may result
in undefined behavior.

Since adding a regression test would require to create a dialect 1
database, we go without it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect NUMERIC value returned from Firebird PDO query in PHP 8.1
1 participant