dmitry Fri Dec 19 06:22:14 2003 EDT
Added files:
/php-src/tests/classes array_access_006.phpt
Modified files:
/ZendEngine2 zend_execute.c
Log:
Assign_op operators (+=) were fixed for elements of overloaded objects
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.571 ZendEngine2/zend_execute.c:1.572
--- ZendEngine2/zend_execute.c:1.571 Thu Dec 18 18:30:22 2003
+++ ZendEngine2/zend_execute.c Fri Dec 19 06:22:12 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute.c,v 1.571 2003/12/18 23:30:22 andi Exp $ */
+/* $Id: zend_execute.c,v 1.572 2003/12/19 11:22:12 dmitry Exp $ */
#define ZEND_INTENSIVE_DEBUGGING 0
@@ -1591,24 +1591,21 @@
return zend_binary_assign_op_obj_helper(binary_op,
ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
break;
case ZEND_ASSIGN_DIM: {
- zend_op *op_data = EX(opline)+1;
zval **object_ptr =
get_obj_zval_ptr_ptr(&EX(opline)->op1, EX(Ts), BP_VAR_W TSRMLS_CC);
+ (*object_ptr)->refcount++; /* undo the effect of
get_obj_zval_ptr_ptr() */
+
if ((*object_ptr)->type == IS_OBJECT) {
- zend_assign_to_object(&EX(opline)->result,
object_ptr, &EX(opline)->op2, &op_data->op1, EX(Ts), ZEND_ASSIGN_DIM TSRMLS_CC);
- EX(opline)++;
- NEXT_OPCODE();
+ return
zend_binary_assign_op_obj_helper(binary_op, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
} else {
zend_op *data_opline = EX(opline)+1;
- (*object_ptr)->refcount++; /* undo the effect
of get_obj_zval_ptr_ptr() */
zend_fetch_dimension_address(&data_opline->op2, &EX(opline)->op1, &EX(opline)->op2,
EX(Ts), BP_VAR_RW TSRMLS_CC);
value = get_zval_ptr(&data_opline->op1,
EX(Ts), &EG(free_op1), BP_VAR_R);
var_ptr = get_zval_ptr_ptr(&data_opline->op2,
EX(Ts), BP_VAR_RW);
EG(free_op2) = 0;
increment_opline = 1;
-/* zend_assign_to_variable(&EX(opline)->result,
&data_opline->op2, &data_opline->op1, value,
(EG(free_op1)?IS_TMP_VAR:EX(opline)->op1.op_type), EX(Ts) TSRMLS_CC); */
}
}
break;
Index: php-src/tests/classes/array_access_006.phpt
+++ php-src/tests/classes/array_access_006.phpt
--TEST--
ZE2 ArrayAccess and ASSIGN_OP operators (+=)
--FILE--
<?php
class OverloadedArray implements ArrayAccess {
public $realArray;
function __construct() {
$this->realArray = array(1,2,3);
}
function offsetExists($index) {
return array_key_exists($this->realArray, $index);
}
function offsetGet($index) {
return $this->realArray[$index];
}
function offsetSet($index, $value) {
$this->realArray[$index] = $value;
}
function offsetUnset($index) {
unset($this->realArray[$index]);
}
}
$a = new OverloadedArray;
$a[1] += 10;
var_dump($a[1]);
echo "---Done---\n";
?>
--EXPECT--
int(12)
---Done---
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php