From: Felipe Pena Date: Sun, 19 Jul 2009 18:55:31 +0000 (+0000) Subject: - Fixed bug #48773 (Incorrect error when setting PDO::ATTR_STATEMENT_CLASS with ctor_... X-Git-Tag: php-5.4.0alpha1~191^2~3050 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73e8c2e140ae8f1cd88d2aa9dfb83b46c9081f72;p=php - Fixed bug #48773 (Incorrect error when setting PDO::ATTR_STATEMENT_CLASS with ctor_args) [HEAD only] --- diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index c88b2b782c..283980c8b5 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -775,8 +775,8 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, long attr, zval *value TSRMLS_D } if (Z_TYPE_P(value) != IS_ARRAY || zend_hash_index_find(Z_ARRVAL_P(value), 0, (void**)&item) == FAILURE - || Z_TYPE_PP(item) != IS_STRING - || zend_lookup_class(Z_STRVAL_PP(item), Z_STRLEN_PP(item), &pce TSRMLS_CC) == FAILURE + || !PDO_ZVAL_PP_IS_TEXT(item) + || zend_u_lookup_class(Z_TYPE_PP(item), Z_UNIVAL_PP(item), Z_UNILEN_PP(item), &pce TSRMLS_CC) == FAILURE ) { pdo_raise_impl_error(dbh, NULL, "HY000", "PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); " diff --git a/ext/pdo_sqlite/tests/bug48773.phpt b/ext/pdo_sqlite/tests/bug48773.phpt new file mode 100644 index 0000000000..b8bdea9185 --- /dev/null +++ b/ext/pdo_sqlite/tests/bug48773.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #48773 (Incorrect error when setting PDO::ATTR_STATEMENT_CLASS with ctor_args) +--SKIPIF-- + +--FILE-- +setAttribute(PDO::ATTR_STATEMENT_CLASS, array($this->statementClass, array($this))); + } +} + +$db = new foo('sqlite::memory:', '', ''); +$stmt = $db->query('SELECT 1'); +var_dump($stmt); + +?> +--EXPECTF-- +object(bar)#%d (1) { + [%u|b%"queryString"]=> + %unicode|string%(8) "SELECT 1" +}