]> granicus.if.org Git - php/commitdiff
- Revert the revert of these patches. This overloading can only be used
authorAndi Gutmans <andi@php.net>
Tue, 2 Dec 2003 21:09:24 +0000 (21:09 +0000)
committerAndi Gutmans <andi@php.net>
Tue, 2 Dec 2003 21:09:24 +0000 (21:09 +0000)
- by C extensions such as SimpleXML and *NOT* PHP code. Reasons given
- on the mailing list and problem with reentrancy inside the opcodes.

Zend/zend_API.c
Zend/zend_operators.c

index 404c6a4273c14ce108babfc93deeb58e83318290..00ed8abb2e9e3657daf26e45f010f5cc259215ce 100644 (file)
@@ -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";
                                }
index d26bee861e29a777573e14b689cf2674815a7c09..8a6f78e6456b9df029f29889f732f1198a850cc5 100644 (file)
@@ -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;