@@ -360,10 +360,9 @@ static inline void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zv
360
360
static inline void zend_assign_to_object (znode * result , zval * * object_ptr , znode * op2 , znode * value_op , temp_variable * Ts , int opcode TSRMLS_DC )
361
361
{
362
362
zval * object ;
363
- zval * property = get_zval_ptr (op2 , Ts , & EG (free_op2 ), BP_VAR_R );
363
+ zval * property_name = get_zval_ptr (op2 , Ts , & EG (free_op2 ), BP_VAR_R );
364
364
zval * free_value ;
365
365
zval * value = get_zval_ptr (value_op , Ts , & free_value , BP_VAR_R );
366
- zval tmp ;
367
366
zval * * retval = & T (result -> u .var ).var .ptr ;
368
367
369
368
make_real_object (object_ptr TSRMLS_CC ); /* this should modify object only if it's empty */
@@ -380,27 +379,10 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode
380
379
}
381
380
382
381
/* here we are sure we are dealing with an object */
383
- switch (op2 -> op_type ) {
384
- case IS_CONST :
385
- /* already a constant string */
386
- break ;
387
- case IS_VAR :
388
- tmp = * property ;
389
- zval_copy_ctor (& tmp );
390
- convert_to_string (& tmp );
391
- property = & tmp ;
392
- break ;
393
- case IS_TMP_VAR :
394
- convert_to_string (property );
395
- break ;
396
- }
397
-
398
382
if (EG (implicit_clone )) {
399
383
SEPARATE_ZVAL_IF_NOT_REF (object_ptr );
400
384
object = * object_ptr ;
401
385
}
402
- /* by now, property is a string */
403
-
404
386
405
387
/* separate our value if necessary */
406
388
if (value_op -> op_type == IS_TMP_VAR ) {
@@ -412,15 +394,32 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode
412
394
value -> refcount = 0 ;
413
395
}
414
396
if (opcode == ZEND_ASSIGN_OBJ ) {
415
- Z_OBJ_HT_P (object )-> write_property (object , property , value TSRMLS_CC );
397
+ zval tmp ;
398
+
399
+ switch (op2 -> op_type ) {
400
+ case IS_CONST :
401
+ /* already a constant string */
402
+ break ;
403
+ case IS_VAR :
404
+ tmp = * property_name ;
405
+ zval_copy_ctor (& tmp );
406
+ convert_to_string (& tmp );
407
+ property_name = & tmp ;
408
+ break ;
409
+ case IS_TMP_VAR :
410
+ convert_to_string (property_name );
411
+ break ;
412
+ }
413
+ Z_OBJ_HT_P (object )-> write_property (object , property_name , value TSRMLS_CC );
414
+ if (property_name == & tmp ) {
415
+ zval_dtor (property_name );
416
+ }
416
417
} else {
418
+ /* Note: property_name in this case is really the array index! */
417
419
if (!Z_OBJ_HT_P (object )-> write_dimension ) {
418
420
zend_error (E_ERROR , "Cannot use object as array" );
419
421
}
420
- Z_OBJ_HT_P (object )-> write_dimension (object , property , value TSRMLS_CC );
421
- }
422
- if (property == & tmp ) {
423
- zval_dtor (property );
422
+ Z_OBJ_HT_P (object )-> write_dimension (object , property_name , value TSRMLS_CC );
424
423
}
425
424
426
425
FREE_OP (Ts , op2 , EG (free_op2 ));
0 commit comments