From 44377c3c704a539a0f93290813d6caf6b4202701 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Tue, 29 Nov 2022 15:32:46 +0100 Subject: [PATCH] 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. --- NEWS | 4 ++++ ext/pdo_firebird/firebird_statement.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/NEWS b/NEWS index e8d436e0fa5..b82ddf8f823 100644 --- a/NEWS +++ b/NEWS @@ -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) diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index d2b0a720b62..04a911c0c76 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -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() }