1
0
mirror of https://github.com/php/php-src.git synced 2026-03-28 02:02:32 +01:00

Merge branch 'PHP-7.0' into PHP-7.1

This commit is contained in:
Nikita Popov
2016-08-16 21:05:57 +02:00
2 changed files with 21 additions and 1 deletions

18
Zend/tests/bug72854.phpt Normal file
View File

@@ -0,0 +1,18 @@
--TEST--
Bug #72854: PHP Crashes on duplicate destructor call
--FILE--
<?php
function get() {
$t = new stdClass;
$t->prop = $t;
return $t;
}
$i = 42;
get()->prop =& $i;
?>
===DONE===
--EXPECT--
===DONE===

View File

@@ -567,6 +567,7 @@ static inline zval *_get_obj_zval_ptr_ptr(int op_type, znode_op node, zend_execu
static inline void zend_assign_to_variable_reference(zval *variable_ptr, zval *value_ptr)
{
zend_reference *ref;
zval garbage;
if (EXPECTED(!Z_ISREF_P(value_ptr))) {
ZVAL_NEW_REF(value_ptr, value_ptr);
@@ -576,8 +577,9 @@ static inline void zend_assign_to_variable_reference(zval *variable_ptr, zval *v
ref = Z_REF_P(value_ptr);
GC_REFCOUNT(ref)++;
zval_ptr_dtor(variable_ptr);
ZVAL_COPY_VALUE(&garbage, variable_ptr);
ZVAL_REF(variable_ptr, ref);
zval_ptr_dtor(&garbage);
}
/* this should modify object only if it's empty */