Skip to content

Commit 198afbe

Browse files
committed
Accept strings values again for integer attribute values
1 parent f0b9c2a commit 198afbe

File tree

4 files changed

+3
-4
lines changed

4 files changed

+3
-4
lines changed

ext/pdo/pdo_dbh.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,8 +678,9 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value) /*
678678
{
679679
zend_long lval;
680680

681+
/* TODO: Make distinction between numeric and non-numeric strings */
681682
#define PDO_LONG_PARAM_CHECK \
682-
if (Z_TYPE_P(value) != IS_LONG && Z_TYPE_P(value) != IS_FALSE && Z_TYPE_P(value) != IS_TRUE) { \
683+
if (Z_TYPE_P(value) != IS_LONG && Z_TYPE_P(value) != IS_STRING && Z_TYPE_P(value) != IS_FALSE && Z_TYPE_P(value) != IS_TRUE) { \
683684
zend_type_error("Attribute value must be int for selected attribute, %s given", zend_zval_type_name(value)); \
684685
return FAILURE; \
685686
} \

ext/pdo/tests/bug_44159.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ TypeError: PDO::ATTR_STATEMENT_CLASS value must be of type array, int given
4444
TypeError: PDO::ATTR_STATEMENT_CLASS value must be of type array, string given
4545
TypeError: Attribute value must be int for selected attribute, null given
4646
bool(true)
47-
TypeError: Attribute value must be int for selected attribute, string given
47+
bool(true)

ext/pdo_mysql/tests/pdo_mysql_attr_errmode.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ error_reporting=E_ALL
160160
--EXPECTF--
161161
TypeError: Attribute value must be int for selected attribute, array given
162162
TypeError: Attribute value must be int for selected attribute, stdClass given
163-
TypeError: Attribute value must be int for selected attribute, string given
164163
ValueError: Error mode must be one of the PDO::ERRMODE_* constants
165164

166165
Warning: PDO::query(): SQLSTATE[42000]: Syntax error or access violation: %d You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near '%s' at line %d in %s on line %d

ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ MySQLPDOTest::skip();
9090
--EXPECTF--
9191
Attribute value must be int for selected attribute, array given
9292
Attribute value must be int for selected attribute, stdClass given
93-
Attribute value must be int for selected attribute, string given
9493
array(1) {
9594
[0]=>
9695
array(6) {

0 commit comments

Comments
 (0)