]> granicus.if.org Git - php/commitdiff
Fixed bug #71470
authorNikita Popov <nikic@php.net>
Wed, 24 Feb 2016 13:07:06 +0000 (14:07 +0100)
committerNikita Popov <nikic@php.net>
Wed, 24 Feb 2016 13:09:03 +0000 (14:09 +0100)
Don't report hashtable iterator leaks on unclean shutdown, those
are expected.

NEWS
Zend/tests/bug71470.phpt [new file with mode: 0644]
Zend/zend_execute_API.c

diff --git a/NEWS b/NEWS
index abc1f6f480d1e4e99c73dfb57e634461546d1478..27dfe7383233d06842e1cb7d0146450ce8faa369 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ PHP                                                                        NEWS
   . Fixed bug #71596 (Segmentation fault on ZTS with date function
     (setlocale)). (Anatol)
   . Fixed bug #71535 (Integer overflow in zend_mm_alloc_heap()). (Dmitry)
+  . Fixed bug #71470 (Leaked 1 hashtable iterators). (Nikita)
 
 - ODBC:
   . Fixed bug #47803, #69526 (Executing prepared statements is succesfull only
diff --git a/Zend/tests/bug71470.phpt b/Zend/tests/bug71470.phpt
new file mode 100644 (file)
index 0000000..6f8b4f0
--- /dev/null
@@ -0,0 +1,13 @@
+--TEST--
+Bug #71470: Leaked 1 hashtable iterators
+--FILE--
+<?php
+
+$array = [1, 2, 3];
+foreach ($array as &$v) {
+    die("foo\n");
+}
+
+?>
+--EXPECT--
+foo
index 0c6f0377dab343d7c1f907723a51c2906f553235..56ad4366ff87331497a4a979d3d8affa0d850cb4 100644 (file)
@@ -398,7 +398,7 @@ void shutdown_executor(void) /* {{{ */
        zend_shutdown_fpu();
 
 #ifdef ZEND_DEBUG
-       if (EG(ht_iterators_used)) {
+       if (EG(ht_iterators_used) && !CG(unclean_shutdown)) {
                zend_error(E_WARNING, "Leaked %" PRIu32 " hashtable iterators", EG(ht_iterators_used));
        }
 #endif