diff options
| -rw-r--r-- | Zend/zend_operators.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 78f7c0d971..1918f30a25 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -319,15 +319,15 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC) #define convert_object_to_type(op, ctype, conv_func) \ if (Z_OBJ_HT_P(op)->cast_object) { \ - zval *org; \ - ALLOC_ZVAL(org); \ - *org = *op; \ - if (Z_OBJ_HT_P(op)->cast_object(org, op, ctype TSRMLS_CC) == FAILURE) { \ + zval dst; \ + if (Z_OBJ_HT_P(op)->cast_object(op, &dst, ctype TSRMLS_CC) == FAILURE) { \ zend_error(E_RECOVERABLE_ERROR, \ - "Object of class %v could not be converted to " # ctype, Z_OBJCE_P(org)->name); \ - INIT_ZVAL(*op); \ + "Object of class %v could not be converted to " # ctype, Z_OBJCE_P(op)->name); \ + } else { \ + zval_dtor(op); \ + op->type = ctype; \ + op->value = dst.value; \ } \ - zval_dtor(org); \ } else { \ if(Z_OBJ_HT_P(op)->get) { \ zval *newop = Z_OBJ_HT_P(op)->get(op TSRMLS_CC); \ |
