mirror of
https://github.com/php/php-src.git
synced 2026-04-28 18:53:33 +02:00
MFB: Fixed bug #38252 (Incorrect PDO error message on invalid default fetch
mode).
This commit is contained in:
@@ -711,6 +711,15 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, long attr, zval *value TSRMLS_D
|
||||
return SUCCESS;
|
||||
|
||||
case PDO_ATTR_DEFAULT_FETCH_MODE:
|
||||
if (Z_TYPE_P(value) == IS_ARRAY) {
|
||||
zval **tmp;
|
||||
if (zend_hash_index_find(Z_ARRVAL_P(value), 0, (void**)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_LONG) {
|
||||
if (Z_LVAL_PP(tmp) == PDO_FETCH_INTO || Z_LVAL_PP(tmp) == PDO_FETCH_CLASS) {
|
||||
pdo_raise_impl_error(dbh, NULL, "HY000", "FETCH_INTO and FETCH_CLASS are not yet supported as default fetch modes" TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
convert_to_long(value);
|
||||
if (Z_LVAL_P(value) == PDO_FETCH_USE_DEFAULT) {
|
||||
pdo_raise_impl_error(dbh, NULL, "HY000", "invalid fetch mode type" TSRMLS_CC);
|
||||
|
||||
Reference in New Issue
Block a user