mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Fixed bug #43851 (Memory corrution on reuse of assigned value)
This commit is contained in:
parent
ba8acfdfdf
commit
e6588b6620
13
Zend/tests/bug43851.phpt
Normal file
13
Zend/tests/bug43851.phpt
Normal file
@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #43851 (Memory corrution on reuse of assigned value)
|
||||
--FILE--
|
||||
<?php
|
||||
foo();
|
||||
function foo() {
|
||||
global $LAST;
|
||||
($LAST = $LAST + 0) * 1;
|
||||
echo "ok\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
@ -693,7 +693,7 @@ static inline zval* zend_assign_to_variable(zval **variable_ptr_ptr, zval *value
|
||||
|
||||
if (Z_TYPE_P(variable_ptr) == IS_OBJECT && Z_OBJ_HANDLER_P(variable_ptr, set)) {
|
||||
Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr_ptr, value TSRMLS_CC);
|
||||
return value;
|
||||
return variable_ptr;
|
||||
}
|
||||
|
||||
if (EG(ze1_compatibility_mode) && Z_TYPE_P(value) == IS_OBJECT) {
|
||||
@ -722,7 +722,7 @@ static inline zval* zend_assign_to_variable(zval **variable_ptr_ptr, zval *value
|
||||
Z_DELREF_P(value);
|
||||
}
|
||||
zendi_zval_dtor(garbage);
|
||||
return value;
|
||||
return variable_ptr;
|
||||
}
|
||||
} else {
|
||||
if (variable_ptr != value) {
|
||||
@ -760,7 +760,7 @@ static inline zval* zend_assign_to_variable(zval **variable_ptr_ptr, zval *value
|
||||
Z_DELREF_P(value);
|
||||
}
|
||||
zendi_zval_dtor(garbage);
|
||||
return value;
|
||||
return variable_ptr;
|
||||
}
|
||||
} else {
|
||||
if (Z_DELREF_P(variable_ptr)==0) {
|
||||
|
Loading…
Reference in New Issue
Block a user