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:
Stanislav Malyshev 2014-06-10 23:19:21 -07:00
commit f11bba4929
3 changed files with 28 additions and 1 deletions

View File

@ -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;

View 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!

View File

@ -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