Fix GH-9971: Incorrect NUMERIC value returned from PDO_Firebird

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.

Closes GH-10021.
This commit is contained in:
Christoph M. Becker 2022-11-29 15:32:46 +01:00
parent bcc00304c7
commit 44377c3c70
No known key found for this signature in database
GPG Key ID: D66C9593118BCCB6
2 changed files with 6 additions and 0 deletions

4
NEWS
View File

@ -36,6 +36,10 @@ PHP NEWS
. Fixed bug GH-9298 (Signal handler called after rshutdown leads to crash).
(Erki Aring)
- PDO_Firebird:
. Fixed bug GH-9971 (Incorrect NUMERIC value returned from PDO_Firebird).
(cmb)
- Session:
. Fixed GH-9932 (session name silently fails with . and [). (David Carlier)

View File

@ -382,6 +382,8 @@ static int firebird_stmt_get_col(
case SQL_INT64:
n = *(ISC_INT64*)var->sqldata;
break;
case SQL_DOUBLE:
break;
EMPTY_SWITCH_DEFAULT_CASE()
}