From b333164423010ad741f45f6f8eccd1c484ba43fc Mon Sep 17 00:00:00 2001 From: SakiTakamachi Date: Tue, 19 Dec 2023 00:22:49 +0900 Subject: [PATCH] Fix GH-12969: Fixed PDO::getAttribute() to get PDO::ATTR_STRINGIFY_FETCHES Partial backport of GH-12793. Closes GH-12970. --- NEWS | 6 +++++- ext/pdo/pdo_dbh.c | 5 +++++ ext/pdo_mysql/tests/bug68371.phpt | 2 +- ext/pdo_pgsql/tests/bug68371.phpt | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index b98074d0635..2a6526a18a5 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,10 @@ PHP NEWS . Fixed bug GH-12987 (openssl_csr_sign might leak new cert on error). (Jakub Zelenka) +- PDO: + . Fix GH-12969 (Fixed PDO::getAttribute() to get PDO::ATTR_STRINGIFY_FETCHES). + (SakiTakamachi) + - PDO_ODBC: . Fixed bug GH-12767 (Unable to turn on autocommit mode with setAttribute()). (SakiTakamachi) @@ -67,7 +71,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) diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 96fa350016a..fc6494f2908 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 bc96ce8eda8..0577929ca40 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 04a0dd70dd3..32173a5a964 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)