felipe Mon Nov 3 23:45:17 2008 UTC Added files: (Branch: PHP_5_2) /php-src/ext/pdo_sqlite/tests bug44327_3.phpt
Modified files: /php-src/ext/pdo pdo_stmt.c Log: - MFH: Improved fix http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_stmt.c?r1=1.118.2.38.2.43&r2=1.118.2.38.2.44&diff_format=u Index: php-src/ext/pdo/pdo_stmt.c diff -u php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.43 php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.44 --- php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.43 Mon Nov 3 20:55:01 2008 +++ php-src/ext/pdo/pdo_stmt.c Mon Nov 3 23:45:17 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdo_stmt.c,v 1.118.2.38.2.43 2008/11/03 20:55:01 felipe Exp $ */ +/* $Id: pdo_stmt.c,v 1.118.2.38.2.44 2008/11/03 23:45:17 felipe Exp $ */ /* The PDO Statement Handle Class */ @@ -2596,10 +2596,8 @@ pdo_stmt_t * stmt = (pdo_stmt_t *) zend_object_store_get_object(object TSRMLS_CC); int colno = -1; - if (Z_TYPE_P(member) == IS_STRING && strcmp(Z_STRVAL_P(member), "queryString") == 0) { - return std_object_handlers.read_property(object, member, IS_STRING TSRMLS_CC); - } MAKE_STD_ZVAL(return_value); + RETVAL_NULL(); if (Z_TYPE_P(member) == IS_LONG) { if (Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count) { @@ -2612,9 +2610,15 @@ for (colno = 0; colno < stmt->column_count; colno++) { if (strcmp(stmt->columns[colno].name, Z_STRVAL_P(member)) == 0) { fetch_value(stmt, return_value, colno, NULL TSRMLS_CC); - break; + return_value->refcount = 0; + return_value->is_ref = 0; + return return_value; } } + if (strcmp(Z_STRVAL_P(member), "queryString") == 0) { + zval_ptr_dtor(&return_value); + return std_object_handlers.read_property(object, member, IS_STRING TSRMLS_CC); + } } return_value->refcount = 0; http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_sqlite/tests/bug44327_3.phpt?view=markup&rev=1.1 Index: php-src/ext/pdo_sqlite/tests/bug44327_3.phpt +++ php-src/ext/pdo_sqlite/tests/bug44327_3.phpt --TEST-- Bug #44327.3 (PDORow::queryString property & numeric offsets / Crash) --SKIPIF-- <?php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?> --FILE-- <?php $db = new pdo('sqlite:memory'); $x = $db->query('select 1 as queryStringxx'); $y = $x->fetch(PDO::FETCH_LAZY); var_dump($y, $y->queryString, $y->queryStringzz, $y->queryStringxx); print "---\n"; var_dump($y[5], $y->{3}); ?> --EXPECTF-- object(PDORow)#%d (2) { ["queryString"]=> string(25) "select 1 as queryStringxx" ["queryStringxx"]=> string(1) "1" } string(25) "select 1 as queryStringxx" NULL string(1) "1" --- NULL NULL -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php