summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2010-05-11 10:03:16 +0000
committerAndrey Hristov <andrey@php.net>2010-05-11 10:03:16 +0000
commit962aa93ec78493441a322630b70261d1b0a74e64 (patch)
treeb165b7df9950cf0e72b9fdbf2362e6f1669581aa
parentd787d545d2b7e0920b7db04aaa40fc4973c49d82 (diff)
downloadphp-git-962aa93ec78493441a322630b70261d1b0a74e64.tar.gz
Fix for bug #51605 (Mysqli zombie links)
-rw-r--r--NEWS1
-rw-r--r--ext/mysqli/mysqli_api.c2
-rw-r--r--ext/mysqli/tests/bug51605.phpt36
3 files changed, 38 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 7108bd2959..052dd8f06f 100644
--- a/NEWS
+++ b/NEWS
@@ -67,6 +67,7 @@ PHP NEWS
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)
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index bd2cdcb0cf..e8f4d02467 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -562,13 +562,13 @@ void php_mysqli_close(MY_MYSQL * mysql, int close_type TSRMLS_DC)
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);
diff --git a/ext/mysqli/tests/bug51605.phpt b/ext/mysqli/tests/bug51605.phpt
new file mode 100644
index 0000000000..d8e5c88afc
--- /dev/null
+++ b/ext/mysqli/tests/bug51605.phpt
@@ -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!