iliaa Mon Jul 31 20:19:18 2006 UTC Modified files: /php-src/ext/pdo_mysql/tests bug_37445.phpt /php-src/ext/pdo pdo_dbh.c pdo_stmt.c Log: MFB: Fixed bug #37445 (Fixed crash in pdo_mysql resulting from premature object destruction). http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_mysql/tests/bug_37445.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/pdo_mysql/tests/bug_37445.phpt diff -u /dev/null php-src/ext/pdo_mysql/tests/bug_37445.phpt:1.2 --- /dev/null Mon Jul 31 20:19:18 2006 +++ php-src/ext/pdo_mysql/tests/bug_37445.phpt Mon Jul 31 20:19:18 2006 @@ -0,0 +1,21 @@ +--TEST-- +PDO MySQL Bug #37445 (Premature stmt object destruction) +--SKIPIF-- +<?php +if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded'); +require dirname(__FILE__) . '/config.inc'; +require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +PDOTest::skip(); +?> +--FILE-- +<?php +require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); + +$db->setAttribute(PDO :: ATTR_EMULATE_PREPARES, true); +$stmt = $db->prepare("SELECT 1"); +$stmt->bindParam(':a', 'b'); + +--EXPECTF-- +Fatal error: Cannot pass parameter 2 by reference in %s/bug_37445.php on line %d \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_dbh.c?r1=1.131&r2=1.132&diff_format=u Index: php-src/ext/pdo/pdo_dbh.c diff -u php-src/ext/pdo/pdo_dbh.c:1.131 php-src/ext/pdo/pdo_dbh.c:1.132 --- php-src/ext/pdo/pdo_dbh.c:1.131 Wed Jun 7 03:33:39 2006 +++ php-src/ext/pdo/pdo_dbh.c Mon Jul 31 20:19:18 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdo_dbh.c,v 1.131 2006/06/07 03:33:39 iliaa Exp $ */ +/* $Id: pdo_dbh.c,v 1.132 2006/07/31 20:19:18 iliaa Exp $ */ /* The PDO Database Handle Class */ @@ -575,6 +575,7 @@ stmt->dbh = dbh; /* give it a reference to me */ zend_objects_store_add_ref(getThis() TSRMLS_CC); + php_pdo_dbh_addref(dbh TSRMLS_CC); stmt->database_object_handle = *getThis(); /* we haven't created a lazy object yet */ ZVAL_NULL(&stmt->lazy_object_ref); @@ -1013,6 +1014,7 @@ stmt->dbh = dbh; /* give it a reference to me */ zend_objects_store_add_ref(getThis() TSRMLS_CC); + php_pdo_dbh_addref(dbh TSRMLS_CC); stmt->database_object_handle = *getThis(); /* we haven't created a lazy object yet */ ZVAL_NULL(&stmt->lazy_object_ref); http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_stmt.c?r1=1.161&r2=1.162&diff_format=u Index: php-src/ext/pdo/pdo_stmt.c diff -u php-src/ext/pdo/pdo_stmt.c:1.161 php-src/ext/pdo/pdo_stmt.c:1.162 --- php-src/ext/pdo/pdo_stmt.c:1.161 Sun Jul 30 11:20:40 2006 +++ php-src/ext/pdo/pdo_stmt.c Mon Jul 31 20:19:18 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdo_stmt.c,v 1.161 2006/07/30 11:20:40 tony2001 Exp $ */ +/* $Id: pdo_stmt.c,v 1.162 2006/07/31 20:19:18 iliaa Exp $ */ /* The PDO Statement Handle Class */ @@ -2154,6 +2154,7 @@ do_fetch_opt_finish(stmt, 1 TSRMLS_CC); zend_objects_store_del_ref(&stmt->database_object_handle TSRMLS_CC); + php_pdo_dbh_delref(stmt->dbh TSRMLS_CC); efree(stmt); }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php