Skip to content

Fix GH-12969: Fixed PDO::getAttribute() to get PDO::ATTR_STRINGIFY_FETCHES #12970

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 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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).
Expand Down
3 changes: 3 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions ext/pdo/pdo_dbh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/pdo_mysql/tests/bug68371.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ array(1) {
ERR
ERR
string(5) "mysql"
ERR
bool(false)
ERR
int(4)
2 changes: 1 addition & 1 deletion ext/pdo_pgsql/tests/bug68371.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ array(1) {
ERR
ERR
string(5) "pgsql"
ERR
bool(true)
ERR
int(4)