mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
- Use object handler get in the same way as the rest of the engine does
This commit is contained in:
parent
52fe090ef0
commit
cd35eae1aa
1 changed files with 12 additions and 3 deletions
15
Zend/zend.c
15
Zend/zend.c
|
@ -358,16 +358,19 @@ ZEND_API void zend_make_string_zval(zval *expr, zval *expr_copy, int *use_copy)
|
|||
}
|
||||
if (Z_OBJ_HANDLER_P(expr, get)) {
|
||||
zval *z = Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC);
|
||||
|
||||
z->refcount++;
|
||||
if(Z_TYPE_P(z) != IS_OBJECT) {
|
||||
zend_make_string_zval(z, expr_copy, use_copy);
|
||||
if (*use_copy) {
|
||||
FREE_ZVAL(z);
|
||||
zval_ptr_dtor(&z);
|
||||
} else {
|
||||
ZVAL_ZVAL(expr_copy, z, 0, 1);
|
||||
*use_copy = 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
zval_ptr_dtor(&z);
|
||||
}
|
||||
zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %v could not be converted to string", Z_OBJCE_P(expr)->name);
|
||||
ZVAL_EMPTY_STRING(expr_copy);
|
||||
|
@ -424,16 +427,19 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
|
|||
}
|
||||
if (Z_OBJ_HANDLER_P(expr, get)) {
|
||||
zval *z = Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC);
|
||||
|
||||
z->refcount++;
|
||||
if(Z_TYPE_P(z) != IS_OBJECT) {
|
||||
zend_make_printable_zval(z, expr_copy, use_copy);
|
||||
if (*use_copy) {
|
||||
FREE_ZVAL(z);
|
||||
zval_ptr_dtor(&z);
|
||||
} else {
|
||||
ZVAL_ZVAL(expr_copy, z, 0, 1);
|
||||
*use_copy = 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
zval_ptr_dtor(&z);
|
||||
}
|
||||
zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %v could not be converted to string", Z_OBJCE_P(expr)->name);
|
||||
ZVAL_EMPTY_STRING(expr_copy);
|
||||
|
@ -473,16 +479,19 @@ ZEND_API void zend_make_unicode_zval(zval *expr, zval *expr_copy, int *use_copy)
|
|||
}
|
||||
if (Z_OBJ_HANDLER_P(expr, get)) {
|
||||
zval *z = Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC);
|
||||
|
||||
z->refcount++;
|
||||
if(Z_TYPE_P(z) != IS_OBJECT) {
|
||||
zend_make_unicode_zval(z, expr_copy, use_copy);
|
||||
if (*use_copy) {
|
||||
FREE_ZVAL(z);
|
||||
zval_ptr_dtor(&z);
|
||||
} else {
|
||||
ZVAL_ZVAL(expr_copy, z, 0, 1);
|
||||
*use_copy = 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
zval_ptr_dtor(&z);
|
||||
}
|
||||
zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %v could not be converted to string", Z_OBJCE_P(expr)->name);
|
||||
ZVAL_EMPTY_UNICODE(expr_copy);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue