mirror of
https://github.com/php/php-src.git
synced 2026-04-21 15:08:16 +02:00
Fixed bug #54265 (crash when variable gets reassigned in error handler)
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? Mar 2011, PHP 5.3.6
|
||||
- Zend Engine:
|
||||
. Fixed bug #54265 (crash when variable gets reassigned in error handler).
|
||||
(Dmitry)
|
||||
. Fixed bug #54262 (Crash when assigning value to a dimension in a non-array).
|
||||
(Dmitry)
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #54265 (crash when variable gets reassigned in error handler)
|
||||
--FILE--
|
||||
<?php
|
||||
function my_errorhandler($errno,$errormsg) {
|
||||
global $my_var;
|
||||
$my_var = 0;
|
||||
echo "EROOR: $errormsg\n";
|
||||
}
|
||||
set_error_handler("my_errorhandler");
|
||||
$my_var = str_repeat("A",$my_var[0]->errormsg = "xyz");
|
||||
echo "ok\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
EROOR: Creating default object from empty value
|
||||
ok
|
||||
|
||||
+14
-2
@@ -536,10 +536,22 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, zval
|
||||
(Z_TYPE_P(object) == IS_BOOL && Z_LVAL_P(object) == 0) ||
|
||||
(Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0)) {
|
||||
SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
|
||||
zval_dtor(*object_ptr);
|
||||
object_init(*object_ptr);
|
||||
object = *object_ptr;
|
||||
Z_ADDREF_P(object);
|
||||
zend_error(E_STRICT, "Creating default object from empty value");
|
||||
if (Z_REFCOUNT_P(object) == 1) {
|
||||
/* object was removed by error handler, nothing to assign to */
|
||||
zval_ptr_dtor(&object);
|
||||
if (retval) {
|
||||
*retval = &EG(uninitialized_zval);
|
||||
PZVAL_LOCK(*retval);
|
||||
}
|
||||
FREE_OP(free_value);
|
||||
return;
|
||||
}
|
||||
Z_DELREF_P(object);
|
||||
zval_dtor(object);
|
||||
object_init(object);
|
||||
} else {
|
||||
zend_error(E_WARNING, "Attempt to assign property of non-object");
|
||||
if (!RETURN_VALUE_UNUSED(result)) {
|
||||
|
||||
Reference in New Issue
Block a user