From d78d31f8072f12af07b17470d40aa8ee2a7e8fc4 Mon Sep 17 00:00:00 2001 From: SakiTakamachi Date: Tue, 19 Dec 2023 00:22:49 +0900 Subject: [PATCH 1/2] Fixed PDO::getAttribute() to get PDO::ATTR_STRINGIFY_FETCHES --- ext/pdo/pdo_dbh.c | 5 +++++ ext/pdo_mysql/tests/bug68371.phpt | 2 +- ext/pdo_pgsql/tests/bug68371.phpt | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 96fa350016a4b..fc6494f2908a6 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -930,8 +930,13 @@ PHP_METHOD(PDO, getAttribute) add_next_index_zval(return_value, &dbh->def_stmt_ctor_args); } return; + case PDO_ATTR_DEFAULT_FETCH_MODE: RETURN_LONG(dbh->default_fetch_type); + + case PDO_ATTR_STRINGIFY_FETCHES: + RETURN_BOOL(dbh->stringify); + default: break; } diff --git a/ext/pdo_mysql/tests/bug68371.phpt b/ext/pdo_mysql/tests/bug68371.phpt index bc96ce8eda8e6..0577929ca4029 100644 --- a/ext/pdo_mysql/tests/bug68371.phpt +++ b/ext/pdo_mysql/tests/bug68371.phpt @@ -96,6 +96,6 @@ array(1) { ERR ERR string(5) "mysql" -ERR +bool(false) ERR int(4) diff --git a/ext/pdo_pgsql/tests/bug68371.phpt b/ext/pdo_pgsql/tests/bug68371.phpt index 04a0dd70dd380..32173a5a96450 100644 --- a/ext/pdo_pgsql/tests/bug68371.phpt +++ b/ext/pdo_pgsql/tests/bug68371.phpt @@ -95,6 +95,6 @@ array(1) { ERR ERR string(5) "pgsql" -ERR +bool(true) ERR int(4) From bb43675e18882a0814654706ab1f89322c5768b7 Mon Sep 17 00:00:00 2001 From: SakiTakamachi Date: Tue, 19 Dec 2023 00:22:54 +0900 Subject: [PATCH 2/2] NEWS / UPGRADING --- NEWS | 4 +++- UPGRADING | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 02d57ac87932d..3ca2a9005bc21 100644 --- a/NEWS +++ b/NEWS @@ -62,7 +62,7 @@ PHP NEWS - FTP: . Fixed bug GH-9348 (FTP & SSL session reuse). (nielsdos) - + - Intl: . Fixed bug GH-12635 (Test bug69398.phpt fails with ICU 74.1). (nielsdos) @@ -460,6 +460,8 @@ PHP NEWS . Fix GH-11587 (After php8.1, when PDO::ATTR_EMULATE_PREPARES is true and PDO::ATTR_STRINGIFY_FETCHES is true, decimal zeros are no longer filled). (SakiTakamachi) + . Fix GH-12969 (Fixed PDO::getAttribute() to get PDO::ATTR_STRINGIFY_FETCHES). + (SakiTakamachi) - PDO SQLite: . Fix GH-11492 (Make test failure: ext/pdo_sqlite/tests/bug_42589.phpt). diff --git a/UPGRADING b/UPGRADING index b025364400f4b..1a00f00813505 100644 --- a/UPGRADING +++ b/UPGRADING @@ -229,6 +229,9 @@ PHP 8.2 UPGRADE NOTES This change only affects the encoding selection, not the result of the conversion. +- PDO: + . getAttribute, enabled to get the value of ATTR_STRINGIFY_FETCHES. + - Random . random_bytes() and random_int() now throw \Random\RandomException on CSPRNG failure. Previously a plain \Exception was thrown.