From: Andi Gutmans Date: Tue, 2 Dec 2003 21:09:24 +0000 (+0000) Subject: - Revert the revert of these patches. This overloading can only be used X-Git-Tag: php-5.0.0b3RC1~410 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=23b231d0eb86c3f1ce835f5df3946b1ab35763d9;p=php - Revert the revert of these patches. This overloading can only be used - by C extensions such as SimpleXML and *NOT* PHP code. Reasons given - on the mailing list and problem with reentrancy inside the opcodes. --- diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 404c6a4273..00ed8abb2e 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -315,10 +315,17 @@ static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec TSRMLS_DC) *p = Z_STRVAL_PP(arg); *pl = Z_STRLEN_PP(arg); break; + case IS_OBJECT: { + if (Z_OBJ_HANDLER_PP(arg, cast_object) + && Z_OBJ_HANDLER_PP(arg, cast_object)(*arg, *arg, IS_STRING, 0 TSRMLS_CC) == SUCCESS) { + *pl = Z_STRLEN_PP(arg); + *p = Z_STRVAL_PP(arg); + break; + } + } case IS_ARRAY: case IS_RESOURCE: - case IS_OBJECT: default: return "string"; } diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index d26bee861e..8a6f78e645 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -492,7 +492,6 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) op->value.str.len = sizeof("Array")-1; break; case IS_OBJECT: { -#if ANDI_0 TSRMLS_FETCH(); if (op->value.obj.handlers->cast_object) { if (op->value.obj.handlers->cast_object(op, op, IS_STRING, 1 TSRMLS_CC) == SUCCESS) { @@ -502,7 +501,6 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) } else { zend_error(E_NOTICE, "Object of class %s to string conversion", Z_OBJCE_P(op)->name); } -#endif zval_dtor(op); op->value.str.val = estrndup_rel("Object", sizeof("Object")-1); op->value.str.len = sizeof("Object")-1;