]> granicus.if.org Git - php/commitdiff
Remove automatic call to __toString() since it is supposed to cause too
authorMarcus Boerger <helly@php.net>
Tue, 2 Dec 2003 22:08:51 +0000 (22:08 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 2 Dec 2003 22:08:51 +0000 (22:08 +0000)
much trouble. See discussion on the mailing list.

Zend/zend_object_handlers.c

index 6e3b466c99a9ff1ad0f70b653f57d9ca019ae690..9d9ab3b247c9a88a0ff48b1d48f5428f40efdc62 100644 (file)
@@ -884,35 +884,6 @@ int zend_std_object_get_class_name(zval *object, char **class_name, zend_uint *c
 
 int zend_std_cast_object(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_DC)
 {
-       zval fname, *retval;
-       int is_ref, refcount;
-
-       switch (type) {
-       case IS_STRING:
-               ZVAL_STRING(&fname, "__tostring", 0);
-               if (call_user_function_ex(NULL, &readobj, &fname, &retval, 0, NULL, 0, NULL TSRMLS_CC) == SUCCESS) {
-                       if (retval) {
-                               if (Z_TYPE_P(retval) != IS_STRING) {
-                                       zend_error(E_ERROR, "Method %s::__toString() must return a string value", Z_OBJCE_P(readobj)->name);
-                               }
-                       } else {
-                               MAKE_STD_ZVAL(retval);
-                               ZVAL_STRINGL(retval, empty_string, 0, 0);
-                       }
-                       zval_dtor(writeobj);
-                       is_ref = writeobj->is_ref;
-                       refcount = writeobj->refcount;
-                       *writeobj = *retval;
-                       zval_copy_ctor(writeobj);
-                       writeobj->is_ref = is_ref;
-                       writeobj->refcount = refcount;
-                       zval_ptr_dtor(&retval);
-                       return SUCCESS;
-               }
-               break;
-       default:
-               break;
-       }
        return FAILURE;
 }