Skip to content

Fixed the condition for result set values to be of native type, making it compatible with previous versions. #11616

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
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
3 changes: 3 additions & 0 deletions ext/pdo/pdo_dbh.c
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,9 @@ static bool pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value) /
return false;
}
dbh->stringify = bval;
if (dbh->methods->set_attribute) {
dbh->methods->set_attribute(dbh, attr, value);
}
return true;

case PDO_ATTR_STATEMENT_CLASS: {
Expand Down
16 changes: 14 additions & 2 deletions ext/pdo_mysql/mysql_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,19 @@ static bool pdo_mysql_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val)
((pdo_mysql_db_handle *)dbh->driver_data)->fetch_table_names = bval;
PDO_DBG_RETURN(true);

#ifndef PDO_USE_MYSQLND
#ifdef PDO_USE_MYSQLND
case PDO_ATTR_STRINGIFY_FETCHES:
if (!pdo_get_bool_param(&bval, val)) {
return false;
}
unsigned int int_and_float_native = !bval;
pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a redundant code, so I'll fix it later

if (mysql_options(H->server, MYSQLND_OPT_INT_AND_FLOAT_NATIVE, (const char *) &int_and_float_native)) {
pdo_mysql_error(dbh);
return false;
}
PDO_DBG_RETURN(true);
#else
case PDO_MYSQL_ATTR_MAX_BUFFER_SIZE:
if (!pdo_get_long_param(&lval, val)) {
PDO_DBG_RETURN(false);
Expand Down Expand Up @@ -891,7 +903,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
}

#ifdef PDO_USE_MYSQLND
unsigned int int_and_float_native = 1;
!pdo_attr_lval(driver_options, PDO_ATTR_STRINGIFY_FETCHES, dbh->stringify);
if (mysql_options(H->server, MYSQLND_OPT_INT_AND_FLOAT_NATIVE, (const char *) &int_and_float_native)) {
pdo_mysql_error(dbh);
goto cleanup;
Expand Down