andrey Tue, 11 May 2010 10:03:16 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=299239
Log: Fix for bug #51605 (Mysqli zombie links) Bug: http://bugs.php.net/51605 (Assigned) Mysqli - zombie links Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c A php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug51605.phpt U php/php-src/trunk/ext/mysqli/mysqli_api.c A php/php-src/trunk/ext/mysqli/tests/bug51605.phpt Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2010-05-11 07:44:06 UTC (rev 299238) +++ php/php-src/branches/PHP_5_3/NEWS 2010-05-11 10:03:16 UTC (rev 299239) @@ -67,6 +67,7 @@ literal). (cbandy at jbandy dot com) - Fixed bug #51607 (pg_copy_from does not allow schema in the tablename argument). (cbandy at jbandy dot com) +- Fixed bug #51605 (Mysqli - zombie links). (Andrey) - Fixed bug #51604 (newline in end of header is shown in start of message). (Daniel Egeberg) - Fixed bug #51590 (JSON_ERROR_UTF8 is undefined). (Felipe) Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c 2010-05-11 07:44:06 UTC (rev 299238) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c 2010-05-11 10:03:16 UTC (rev 299239) @@ -562,13 +562,13 @@ mysqli_plist_entry *plist = (mysqli_plist_entry *) le->ptr; zend_ptr_stack_push(&plist->free_links, mysql->mysql); - MyG(num_links)--; MyG(num_active_persistent)--; MyG(num_inactive_persistent)++; } } mysql->persistent = FALSE; } + MyG(num_links)--; mysql->mysql = NULL; php_clear_mysql(mysql); Added: php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug51605.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug51605.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug51605.phpt 2010-05-11 10:03:16 UTC (rev 299239) @@ -0,0 +1,36 @@ +--TEST-- +Bug #51647 (Certificate file without private key (pk in another file) doesn't work) +--SKIPIF-- +<?php +require_once('skipif.inc'); +require_once('skipifconnectfailure.inc'); +?> +--INI-- +mysqli.max_links = 1 +mysqli.allow_persistent = Off +mysqli.max_persistent = 0 +mysqli.reconnect = Off +--FILE-- +<?php + include ("connect.inc"); + + $link = mysqli_init(); + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { + printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } + mysqli_close($link); + echo "closed once\n"; + + $link = mysqli_init(); + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { + printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } + mysqli_close($link); + echo "closed twice\n"; + + print "done!"; +?> +--EXPECTF-- +closed once +closed twice +done! Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c =================================================================== --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2010-05-11 07:44:06 UTC (rev 299238) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2010-05-11 10:03:16 UTC (rev 299239) @@ -562,7 +562,6 @@ mysqli_plist_entry *plist = (mysqli_plist_entry *) le->ptr; zend_ptr_stack_push(&plist->free_links, mysql->mysql); - MyG(num_links)--; MyG(num_active_persistent)--; MyG(num_inactive_persistent)++; } @@ -570,6 +569,7 @@ mysql->persistent = FALSE; } mysql->mysql = NULL; + MyG(num_links)--; php_clear_mysql(mysql); } Added: php/php-src/trunk/ext/mysqli/tests/bug51605.phpt =================================================================== --- php/php-src/trunk/ext/mysqli/tests/bug51605.phpt (rev 0) +++ php/php-src/trunk/ext/mysqli/tests/bug51605.phpt 2010-05-11 10:03:16 UTC (rev 299239) @@ -0,0 +1,36 @@ +--TEST-- +Bug #51647 (Certificate file without private key (pk in another file) doesn't work) +--SKIPIF-- +<?php +require_once('skipif.inc'); +require_once('skipifconnectfailure.inc'); +?> +--INI-- +mysqli.max_links = 1 +mysqli.allow_persistent = Off +mysqli.max_persistent = 0 +mysqli.reconnect = Off +--FILE-- +<?php + include ("connect.inc"); + + $link = mysqli_init(); + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { + printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } + mysqli_close($link); + echo "closed once\n"; + + $link = mysqli_init(); + if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { + printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); + } + mysqli_close($link); + echo "closed twice\n"; + + print "done!"; +?> +--EXPECTF-- +closed once +closed twice +done!
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php