summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2018-08-17 13:35:15 +0800
committerXinchen Hui <laruence@gmail.com>2018-08-17 13:35:15 +0800
commit04c4854fdfbc11b2b6a2cf1c8045f2efcd5dcdcc (patch)
treef6ebd9dd787dd51bb5e0f6560fe12250420a6bb3
parent64c88c1e168cb4489e5adae4067e35f7abd18046 (diff)
downloadphp-git-04c4854fdfbc11b2b6a2cf1c8045f2efcd5dcdcc.tar.gz
Fixed bug #76754 (parent private constant in extends class memory leak)
-rw-r--r--NEWS2
-rw-r--r--Zend/tests/bug76754.phpt18
-rw-r--r--Zend/zend_opcode.c2
3 files changed, 21 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 4e36b1e807..a3d9ea1e79 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP NEWS
?? ??? ????, PHP 7.1.22
- Core:
+ . Fixed bug #76754 (parent private constant in extends class memory leak).
+ (Laruence)
. Fixed bug #72443 (Generate enabled extension). (petk)
- Bz2:
diff --git a/Zend/tests/bug76754.phpt b/Zend/tests/bug76754.phpt
new file mode 100644
index 0000000000..424f1fbffc
--- /dev/null
+++ b/Zend/tests/bug76754.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #76754 (parent private constant in extends class memory leak)
+--INI--
+opcache.enable=0
+opcache.enable_cli=0
+--FILE--
+<?php
+
+class FOO
+{
+ private const FOO = 'BAR';
+}
+
+class BAR extends FOO { }
+?>
+okey
+--EXPECT--
+okey
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index fe1d95737a..8168f6a047 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -296,8 +296,8 @@ ZEND_API void destroy_zend_class(zval *zv)
}
}
} ZEND_HASH_FOREACH_END();
- zend_hash_destroy(&ce->constants_table);
}
+ zend_hash_destroy(&ce->constants_table);
if (ce->num_interfaces > 0 && ce->interfaces) {
efree(ce->interfaces);
}