From 1442b416a8802573c59765917d6d70691d6926a3 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Sat, 19 Mar 2005 15:15:51 +0000 Subject: [PATCH] - MFH --- Zend/zend_object_handlers.c | 4 +--- ext/spl/tests/bug31185.phpt | 18 +++++++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index e9353d9315..6791327b5d 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -523,13 +523,11 @@ static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC) static void zend_std_unset_dimension(zval *object, zval *offset TSRMLS_DC) { zend_class_entry *ce = Z_OBJCE_P(object); - zval *retval; if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) { SEPARATE_ARG_IF_REF(offset); - zend_call_method_with_1_params(&object, ce, NULL, "offsetunset", &retval, offset); + zend_call_method_with_1_params(&object, ce, NULL, "offsetunset", NULL, offset); zval_ptr_dtor(&offset); - zval_ptr_dtor(&retval); } else { zend_error(E_ERROR, "Cannot use object of type %s as array", ce->name); } diff --git a/ext/spl/tests/bug31185.phpt b/ext/spl/tests/bug31185.phpt index edd90f5b47..b4f315b0b9 100755 --- a/ext/spl/tests/bug31185.phpt +++ b/ext/spl/tests/bug31185.phpt @@ -15,6 +15,7 @@ class FooBar implements ArrayAccess { } public function offsetSet($index, $value) { + echo __METHOD__ . "($index, $value)\n"; $this->array[$index] = $value; } @@ -25,11 +26,11 @@ class FooBar implements ArrayAccess { } -$i = 0; +$i = 0; $j = 0; $foo = new FooBar(); -$foo[$i] = $i++; -$foo[$i] = $i++; -$foo[$i] = $i++; +$foo[$j++] = $i++; +$foo[$j++] = $i++; +$foo[$j++] = $i++; try { unset($foo[1]); @@ -43,14 +44,17 @@ print_R($foo); ?> ===DONE=== --EXPECT-- +FooBar::offsetSet(0, 0) +FooBar::offsetSet(1, 1) +FooBar::offsetSet(2, 2) CAUGHT: FAIL FooBar Object ( [array:private] => Array ( - [1] => 0 - [2] => 1 - [3] => 2 + [0] => 0 + [1] => 1 + [2] => 2 ) ) -- 2.40.0