summaryrefslogtreecommitdiff
path: root/Zend/zend_execute_API.c
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2015-12-17 23:21:48 +0100
committerNikita Popov <nikic@php.net>2015-12-17 23:21:48 +0100
commita917840f38a4743020e0d8a16fcaf23826a87500 (patch)
tree9ce42a6c4c3b6a31cc671d65caba13ba534c38b8 /Zend/zend_execute_API.c
parent6a4c02e107e86a0ff700b79f5a9da0f383c06430 (diff)
downloadphp-git-a917840f38a4743020e0d8a16fcaf23826a87500.tar.gz
Fixed iter leak on by-ref foreach over const/tmp array
FE_FREE does not unregister the iter for plain arrays. So always wrap into a REF wrapper, even if not strictly necessary, in RESET_RW. Alternatively we could use a flag to distinguish plain positions and interators. Also added a check for leaked iterators in shutdown_executor.
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r--Zend/zend_execute_API.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index fdffed34b2..6eafeb7550 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -397,6 +397,12 @@ void shutdown_executor(void) /* {{{ */
zend_shutdown_fpu();
+#ifdef ZEND_DEBUG
+ if (EG(ht_iterators_used)) {
+ zend_error(E_WARNING, "Leaked %" PRIu32 " hashtable iterators", EG(ht_iterators_used));
+ }
+#endif
+
EG(ht_iterators_used) = 0;
if (EG(ht_iterators) != EG(ht_iterators_slots)) {
efree(EG(ht_iterators));