mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: Fix bug #66127 (Segmentation fault with ArrayObject unset) 5.4.31 next Conflicts: configure.in main/php_version.h
This commit is contained in:
commit
f11bba4929
@ -402,7 +402,7 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval
|
||||
/* When in a write context,
|
||||
* ZE has to be fooled into thinking this is in a reference set
|
||||
* by separating (if necessary) and returning as an is_ref=1 zval (even if refcount == 1) */
|
||||
if ((type == BP_VAR_W || type == BP_VAR_RW || type == BP_VAR_UNSET) && !Z_ISREF_PP(ret)) {
|
||||
if ((type == BP_VAR_W || type == BP_VAR_RW || type == BP_VAR_UNSET) && !Z_ISREF_PP(ret) && ret != &EG(uninitialized_zval_ptr)) {
|
||||
if (Z_REFCOUNT_PP(ret) > 1) {
|
||||
zval *newval;
|
||||
|
||||
|
25
ext/spl/tests/bug66127.phpt
Normal file
25
ext/spl/tests/bug66127.phpt
Normal file
@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #66127 (Segmentation fault with ArrayObject unset)
|
||||
--INI--
|
||||
error_reporting = E_ALL & ~E_NOTICE
|
||||
--FILE--
|
||||
<?php
|
||||
function crash()
|
||||
{
|
||||
set_error_handler(function () {});
|
||||
$var = 1;
|
||||
trigger_error('error');
|
||||
$var2 = $var;
|
||||
$var3 = $var;
|
||||
trigger_error('error');
|
||||
}
|
||||
|
||||
$items = new ArrayObject();
|
||||
|
||||
unset($items[0]);
|
||||
unset($items[0][0]);
|
||||
crash();
|
||||
echo "Worked!\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Worked!
|
@ -12,4 +12,6 @@ $a[] = &$tmp;
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Indirect modification of overloaded element of ArrayIterator has no effect in %s on line %d
|
||||
|
||||
Fatal error: Cannot assign by reference to overloaded object in %s on line %d
|
||||
|
Loading…
Reference in New Issue
Block a user