com php-src: Fixed bug #70272 (Segfault in pdo_mysql): NEWS ext/pdo_mysql/mysql_driver.c ext/pdo_mysql/mys ql_statement.c
ext/pdo_mysql/tests/bug70272 .phpt

From: Date: Tue, 18 Aug 2015 10:33:07 +0000
Subject: com php-src: Fixed bug #70272 (Segfault in pdo_mysql): NEWS ext/pdo_mysql/mysql_driver.c ext/pdo_mysql/mys ql_statement.c
ext/pdo_mysql/tests/bug70272 .phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-88579@lists.php.net to get a copy of this message
Commit: dca6d1027a4b4c544c283d0021c0725b9a27cfeb Author: Xinchen Hui <laruence@php.net> Tue, 18 Aug 2015 18:33:07 +0800 Parents: 8df34610869566c5af3f21efa2575e6e2e262d74 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=dca6d1027a4b4c544c283d0021c0725b9a27cfeb Log: Fixed bug #70272 (Segfault in pdo_mysql) Bugs: https://bugs.php.net/70272 Changed paths: M NEWS M ext/pdo_mysql/mysql_driver.c M ext/pdo_mysql/mysql_statement.c A ext/pdo_mysql/tests/bug70272.phpt Diff: diff --git a/NEWS b/NEWS index 6a921d3..be6904e 100644 --- a/NEWS +++ b/NEWS @@ -46,6 +46,7 @@ PHP NEWS match). (cmb) - PDO: + . Fixed bug #70272 (Segfault in pdo_mysql). (Laruence) . Fixed bug #70221 (persistent sqlite connection + custom function segfaults). (Laruence) diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index 4f55d96..8931da2 100644 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -147,11 +147,9 @@ static int mysql_handle_closer(pdo_dbh_t *dbh) if (H) { if (H->server) { mysql_close(H->server); - H->server = NULL; } if (H->einfo.errmsg) { pefree(H->einfo.errmsg, dbh->is_persistent); - H->einfo.errmsg = NULL; } pefree(H, dbh->is_persistent); dbh->driver_data = NULL; diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index 5519605..f558430 100644 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -88,8 +88,8 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt) /* {{{ */ } #endif - - if (S->H->server) { + if (IS_OBJ_VALID(EG(objects_store).object_buckets[Z_OBJ_HANDLE(stmt->database_object_handle)]) + && (!(GC_FLAGS(Z_OBJ(stmt->database_object_handle)) & IS_OBJ_FREE_CALLED))) { while (mysql_more_results(S->H->server)) { MYSQL_RES *res; if (mysql_next_result(S->H->server) != 0) { diff --git a/ext/pdo_mysql/tests/bug70272.phpt b/ext/pdo_mysql/tests/bug70272.phpt new file mode 100644 index 0000000...cd9b9d7 --- /dev/null +++ b/ext/pdo_mysql/tests/bug70272.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #70272 (Segfault in pdo_mysql) +--SKIPIF-- +<?php +require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif..inc'); +require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); +MySQLPDOTest::skip(); +?> +--INI-- +report_memleaks=off +--FILE-- +<?php +$a = new Stdclass(); +$a->a = &$a; +require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + +$dummy = new StdClass(); + +$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +$dummy = NULL; + +$a->c = $db; +$a->b = $db->prepare("select 1"); +$a->d = $db->prepare("select 2"); +$a->e = $db->prepare("select 3"); +$a->f = $db->prepare("select 4"); +gc_disable(); +?> +okey +--EXPECT-- +okey

« previous php.cvs (#88579) next »