From: Xinchen Hui Date: Fri, 10 Jul 2015 07:27:06 +0000 (+0800) Subject: Fixed Issue #1400 (double free static property) X-Git-Tag: php-7.1.1RC1~35^2~35 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a3f05d640d73d61c1978446adb1217f40356d037;p=php Fixed Issue #1400 (double free static property) --- diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 64e7407f12..9b96a4a479 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -821,7 +821,13 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent do { dst--; src--; - ZVAL_MAKE_REF(src); + if (parent_ce->type == ZEND_INTERNAL_CLASS) { + if (!Z_ISREF_P(src)) { + ZVAL_NEW_PERSISTENT_REF(src, src); + } + } else { + ZVAL_MAKE_REF(src); + } ZVAL_COPY_VALUE(dst, src); Z_ADDREF_P(dst); if (Z_CONSTANT_P(Z_REFVAL_P(dst))) {