Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19174 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6601 invoked by uid 1010); 26 Sep 2005 18:55:51 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 6585 invoked from network); 26 Sep 2005 18:55:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Sep 2005 18:55:51 -0000 X-Host-Fingerprint: 84.204.52.251 promo.hnet.spb.ru OpenBSD 3.0-3.4 Received: from ([84.204.52.251:44506] helo=promo.hnet.spb.ru) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id DD/C1-24510-53448334 for ; Mon, 26 Sep 2005 14:55:50 -0400 Received: from thinkpad (unknown [10.1.0.118]) by promo.hnet.spb.ru (Postfix) with ESMTP id 71DB71BACA3; Mon, 26 Sep 2005 22:55:45 +0400 (MSD) To: "'Marcus Boerger'" Cc: "'internals'" Date: Mon, 26 Sep 2005 22:55:30 +0400 Message-ID: <000501c5c2cb$e11449c0$e902a8c0@thinkpad> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0006_01C5C2ED.6825E9C0" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 In-Reply-To: <1728334199.20050925143657@marcus-boerger.de> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 Importance: Normal Subject: RE: [PHP-DEV] [PATCH] __toString() From: dmitry@zend.com ("Dmitry Stogov") References: <1728334199.20050925143657@marcus-boerger.de> ------=_NextPart_000_0006_01C5C2ED.6825E9C0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Hi Marcus, This is improved version of your patch. It breaks only two tests those must be changed. (instead of > 10 those shouldn't) Please review. Thanks. Dmitry. > -----Original Message----- > From: Marcus Boerger [mailto:helly@php.net] > Sent: Sunday, September 25, 2005 4:37 PM > To: internals > Subject: [PHP-DEV] [PATCH] __toString() > > > Hello internals, > > the patch implements __toString to have obejcts be > automatically converted to strings anywhere a string is > requested. We have talked a lot about this in the past and > during OSCON Andi agreed again on it and said that the HEAD > version of the engine should be ready for it now. Futher more > we have enough time to fix any outstanding engine issues > regarding this. > > http://php.net/~helly/php/ext/ze2/ze2-tostring-20050925.diff.txt > > If nobody objects with a real technical issue i'll commit > the patch early in the week. > > The patch is a little big longer because it ensures that > __toString gets treated and especially gets cached just like > any other magic function is. > > Best regards, > Marcus > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > ------=_NextPart_000_0006_01C5C2ED.6825E9C0 Content-Type: text/plain; name="ze2-tostring-20050926_diff.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ze2-tostring-20050926_diff.txt" ? Zend/!=0A= ? Zend/1=0A= ? Zend/NEW_API=0A= ? Zend/zend_API.h.my=0A= ? Zend/tests/bug33512.phpt=0A= ? Zend/tests/bug34062.phpt=0A= Index: Zend/zend.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend.c,v=0A= retrieving revision 1.323=0A= diff -u -p -d -r1.323 zend.c=0A= --- Zend/zend.c 15 Sep 2005 16:19:41 -0000 1.323=0A= +++ Zend/zend.c 26 Sep 2005 12:13:12 -0000=0A= @@ -347,39 +347,28 @@ ZEND_API void zend_make_string_zval(zval=0A= case IS_OBJECT:=0A= {=0A= TSRMLS_FETCH();=0A= -#if 0=0A= - /* Standard PHP objects */=0A= - if (Z_OBJ_HT_P(expr) =3D=3D &std_object_handlers || = !Z_OBJ_HT_P(expr)->cast_object) {=0A= - if (zend_std_cast_object_tostring(expr, expr_copy, IS_STRING, 0 = TSRMLS_CC) =3D=3D SUCCESS) {=0A= - break;=0A= - }=0A= - zend_error(E_NOTICE, "Object of class %v could not be converted to = string", Z_OBJCE_P(expr)->name);=0A= - }=0A= -#endif=0A= if (Z_OBJ_HANDLER_P(expr, cast_object)) {=0A= if(Z_OBJ_HANDLER_P(expr, cast_object)(expr, expr_copy, IS_STRING, = 0 TSRMLS_CC) =3D=3D SUCCESS) {=0A= break;=0A= }=0A= - } else {=0A= - if(Z_OBJ_HANDLER_P(expr, get)) {=0A= - zval *z =3D Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC);=0A= - if(Z_TYPE_P(z) !=3D IS_OBJECT) {=0A= - zend_make_printable_zval(z, expr_copy, use_copy);=0A= - FREE_ZVAL(z);=0A= - return;=0A= - }=0A= + }=0A= + if (Z_OBJ_HANDLER_P(expr, get)) {=0A= + zval *z =3D Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC);=0A= + if(Z_TYPE_P(z) !=3D IS_OBJECT) {=0A= + zend_make_printable_zval(z, expr_copy, use_copy);=0A= + FREE_ZVAL(z);=0A= + break;=0A= }=0A= }=0A= if (EG(exception)) {=0A= - zval_dtor(expr_copy);=0A= expr_copy->value.str.len =3D 0;=0A= expr_copy->value.str.val =3D STR_EMPTY_ALLOC();=0A= break;=0A= }=0A= +=0A= }=0A= expr_copy->value.str.val =3D (char *) emalloc(sizeof("Object id = #")-1 + MAX_LENGTH_OF_LONG);=0A= expr_copy->value.str.len =3D sprintf(expr_copy->value.str.val, = "Object id #%ld", (long)expr->value.obj.handle);=0A= - expr_copy->type =3D IS_STRING;=0A= break;=0A= default:=0A= *expr_copy =3D *expr;=0A= @@ -387,6 +376,7 @@ ZEND_API void zend_make_string_zval(zval=0A= convert_to_string(expr_copy);=0A= break;=0A= }=0A= + expr_copy->type =3D IS_STRING;=0A= *use_copy =3D 1;=0A= }=0A= =0A= @@ -426,40 +416,26 @@ ZEND_API void zend_make_printable_zval(z=0A= expr_copy->value.str.val =3D estrndup("Array", = expr_copy->value.str.len);=0A= break;=0A= case IS_OBJECT:=0A= - {=0A= -#if 0=0A= - /* Standard PHP objects */=0A= - if (Z_OBJ_HT_P(expr) =3D=3D &std_object_handlers || = !Z_OBJ_HT_P(expr)->cast_object) {=0A= - if (zend_std_cast_object_tostring(expr, expr_copy, IS_STRING, 0 = TSRMLS_CC) =3D=3D SUCCESS) {=0A= - break;=0A= - }=0A= - zend_error(E_NOTICE, "Object of class %v could not be converted to = string", Z_OBJCE_P(expr)->name);=0A= - }=0A= -#endif=0A= - if (Z_OBJ_HANDLER_P(expr, cast_object)) {=0A= - if(Z_OBJ_HANDLER_P(expr, cast_object)(expr, expr_copy, IS_STRING, = 0 TSRMLS_CC) =3D=3D SUCCESS) {=0A= - break;=0A= - }=0A= - } else {=0A= - if(Z_OBJ_HANDLER_P(expr, get)) {=0A= - zval *z =3D Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC);=0A= - if(Z_TYPE_P(z) !=3D IS_OBJECT) {=0A= - zend_make_printable_zval(z, expr_copy, use_copy);=0A= - FREE_ZVAL(z);=0A= - return;=0A= - }=0A= - }=0A= + if (Z_OBJ_HANDLER_P(expr, cast_object)) {=0A= + if(Z_OBJ_HANDLER_P(expr, cast_object)(expr, expr_copy, IS_STRING, 0 = TSRMLS_CC) =3D=3D SUCCESS) {=0A= + break;=0A= }=0A= - if (EG(exception)) {=0A= - zval_dtor(expr_copy);=0A= - expr_copy->value.str.len =3D 0;=0A= - expr_copy->value.str.val =3D STR_EMPTY_ALLOC();=0A= + }=0A= + if (Z_OBJ_HANDLER_P(expr, get)) {=0A= + zval *z =3D Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC);=0A= + if(Z_TYPE_P(z) !=3D IS_OBJECT) {=0A= + zend_make_printable_zval(z, expr_copy, use_copy);=0A= + FREE_ZVAL(z);=0A= break;=0A= }=0A= }=0A= + if (EG(exception)) {=0A= + expr_copy->value.str.len =3D 0;=0A= + expr_copy->value.str.val =3D STR_EMPTY_ALLOC();=0A= + break;=0A= + }=0A= expr_copy->value.str.val =3D (char *) emalloc(sizeof("Object id = #")-1 + MAX_LENGTH_OF_LONG);=0A= expr_copy->value.str.len =3D sprintf(expr_copy->value.str.val, = "Object id #%ld", (long)expr->value.obj.handle);=0A= - expr_copy->type =3D IS_STRING;=0A= break;=0A= case IS_DOUBLE:=0A= *expr_copy =3D *expr;=0A= @@ -491,40 +467,26 @@ ZEND_API void zend_make_unicode_zval(zva=0A= }=0A= switch (expr->type) {=0A= case IS_OBJECT:=0A= - {=0A= -#if 0=0A= - /* Standard PHP objects */=0A= - if (Z_OBJ_HT_P(expr) =3D=3D &std_object_handlers || = !Z_OBJ_HT_P(expr)->cast_object) {=0A= - if (zend_std_cast_object_tostring(expr, expr_copy, IS_STRING, 0 = TSRMLS_CC) =3D=3D SUCCESS) {=0A= - break;=0A= - }=0A= - zend_error(E_NOTICE, "Object of class %v could not be converted to = string", Z_OBJCE_P(expr)->name);=0A= - }=0A= -#endif=0A= - if (Z_OBJ_HANDLER_P(expr, cast_object)) {=0A= - if(Z_OBJ_HANDLER_P(expr, cast_object)(expr, expr_copy, IS_UNICODE, = 0 TSRMLS_CC) =3D=3D SUCCESS) {=0A= - break;=0A= - }=0A= - } else {=0A= - if(Z_OBJ_HANDLER_P(expr, get)) {=0A= - zval *z =3D Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC);=0A= - if(Z_TYPE_P(z) !=3D IS_OBJECT) {=0A= - zend_make_unicode_zval(z, expr_copy, use_copy);=0A= - FREE_ZVAL(z);=0A= - return;=0A= - }=0A= - }=0A= + if (Z_OBJ_HANDLER_P(expr, cast_object)) {=0A= + if(Z_OBJ_HANDLER_P(expr, cast_object)(expr, expr_copy, IS_UNICODE, = 0 TSRMLS_CC) =3D=3D SUCCESS) {=0A= + break;=0A= }=0A= - if (EG(exception)) {=0A= - zval_dtor(expr_copy);=0A= - expr_copy->value.ustr.len =3D 0;=0A= - expr_copy->value.ustr.val =3D USTR_MAKE("");=0A= + }=0A= + if (Z_OBJ_HANDLER_P(expr, get)) {=0A= + zval *z =3D Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC);=0A= + if(Z_TYPE_P(z) !=3D IS_OBJECT) {=0A= + zend_make_unicode_zval(z, expr_copy, use_copy);=0A= + FREE_ZVAL(z);=0A= break;=0A= }=0A= }=0A= - expr_copy->value.ustr.val =3D emalloc(sizeof("Object id #")-1 + = MAX_LENGTH_OF_LONG + 1);=0A= + if (EG(exception)) {=0A= + expr_copy->value.ustr.len =3D 0;=0A= + expr_copy->value.ustr.val =3D USTR_MAKE("");=0A= + break;=0A= + }=0A= + expr_copy->value.ustr.val =3D eumalloc(sizeof("Object id #")-1 + = MAX_LENGTH_OF_LONG + 1);=0A= expr_copy->value.ustr.len =3D u_sprintf(expr_copy->value.ustr.val, = "Object id #%ld", (long)expr->value.obj.handle);=0A= - expr_copy->type =3D IS_UNICODE;=0A= break;=0A= default:=0A= *expr_copy =3D *expr;=0A= @@ -532,6 +494,7 @@ ZEND_API void zend_make_unicode_zval(zva=0A= convert_to_unicode(expr_copy);=0A= break;=0A= }=0A= + expr_copy->type =3D IS_UNICODE;=0A= *use_copy =3D 1;=0A= }=0A= =0A= @@ -969,6 +932,8 @@ static void fix_classes(HashTable *ht) {=0A= ce->__isset =3D ce->__isset->common.u_twin;=0A= } else if (ce->__call) {=0A= ce->__call =3D ce->__call->common.u_twin;=0A= + } else if (ce->__tostring) {=0A= + ce->__tostring =3D ce->__tostring->common.u_twin;=0A= } else if (ce->serialize_func) {=0A= ce->serialize_func =3D ce->serialize_func->common.u_twin;=0A= } else if (ce->unserialize_func) {=0A= Index: Zend/zend.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend.h,v=0A= retrieving revision 1.299=0A= diff -u -p -d -r1.299 zend.h=0A= --- Zend/zend.h 1 Sep 2005 10:04:54 -0000 1.299=0A= +++ Zend/zend.h 26 Sep 2005 12:13:13 -0000=0A= @@ -360,6 +360,7 @@ struct _zend_class_entry {=0A= union _zend_function *__unset;=0A= union _zend_function *__isset;=0A= union _zend_function *__call;=0A= + union _zend_function *__tostring;=0A= union _zend_function *serialize_func;=0A= union _zend_function *unserialize_func;=0A= =0A= Index: Zend/zend_API.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_API.c,v=0A= retrieving revision 1.315=0A= diff -u -p -d -r1.315 zend_API.c=0A= --- Zend/zend_API.c 1 Sep 2005 10:04:55 -0000 1.315=0A= +++ Zend/zend_API.c 26 Sep 2005 12:13:16 -0000=0A= @@ -2022,6 +2022,9 @@ ZEND_API void zend_check_magic_method_im=0A= } else if (lcname_len =3D=3D sizeof(ZEND_CALL_FUNC_NAME) - 1 &&=0A= ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_CALL_FUNC_NAME, = sizeof(ZEND_CALL_FUNC_NAME)-1) && fptr->common.num_args !=3D 2) {=0A= zend_error(error_type, "Method %v::%s() must take exactly 2 = arguments", ce->name, ZEND_CALL_FUNC_NAME);=0A= + } else if (lcname_len =3D=3D sizeof(ZEND_TOSTRING_FUNC_NAME) - 1 &&=0A= + ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_TOSTRING_FUNC_NAME, = sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && fptr->common.num_args !=3D 0) {=0A= + zend_error(error_type, "Method %v::%s() cannot take arguments", = ce->name, ZEND_CALL_FUNC_NAME);=0A= }=0A= efree(lcname);=0A= }=0A= @@ -2035,7 +2038,7 @@ ZEND_API int zend_register_functions(zen=0A= int count=3D0, unload=3D0;=0A= HashTable *target_function_table =3D function_table;=0A= int error_type;=0A= - zend_function *ctor =3D NULL, *dtor =3D NULL, *clone =3D NULL, *__get = =3D NULL, *__set =3D NULL, *__unset =3D NULL, *__isset =3D NULL, *__call = =3D NULL;=0A= + zend_function *ctor =3D NULL, *dtor =3D NULL, *clone =3D NULL, *__get = =3D NULL, *__set =3D NULL, *__unset =3D NULL, *__isset =3D NULL, *__call = =3D NULL, *__tostring =3D NULL;=0A= char *lowercase_name;=0A= int fname_len;=0A= char *lc_class_name;=0A= @@ -2139,6 +2142,8 @@ ZEND_API int zend_register_functions(zen=0A= clone =3D reg_function;=0A= } else if ((fname_len =3D=3D sizeof(ZEND_CALL_FUNC_NAME)-1) && = !memcmp(lowercase_name, ZEND_CALL_FUNC_NAME, = sizeof(ZEND_CALL_FUNC_NAME))) {=0A= __call =3D reg_function;=0A= + } else if ((fname_len =3D=3D sizeof(ZEND_CALL_FUNC_NAME)-1) && = !memcmp(lowercase_name, ZEND_TOSTRING_FUNC_NAME, = sizeof(ZEND_TOSTRING_FUNC_NAME))) {=0A= + __tostring =3D reg_function;=0A= } else if ((fname_len =3D=3D sizeof(ZEND_GET_FUNC_NAME)-1) && = !memcmp(lowercase_name, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME))) = {=0A= __get =3D reg_function;=0A= } else if ((fname_len =3D=3D sizeof(ZEND_SET_FUNC_NAME)-1) && = !memcmp(lowercase_name, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME))) = {=0A= @@ -2176,6 +2181,7 @@ ZEND_API int zend_register_functions(zen=0A= scope->destructor =3D dtor;=0A= scope->clone =3D clone;=0A= scope->__call =3D __call;=0A= + scope->__tostring =3D __tostring;=0A= scope->__get =3D __get;=0A= scope->__set =3D __set;=0A= scope->__unset =3D __unset;=0A= @@ -2207,6 +2213,12 @@ ZEND_API int zend_register_functions(zen=0A= }=0A= __call->common.fn_flags &=3D ~ZEND_ACC_ALLOW_STATIC;=0A= }=0A= + if (__tostring) {=0A= + if (__tostring->common.fn_flags & ZEND_ACC_STATIC) {=0A= + zend_error(error_type, "Method %s::%s() cannot be static", = scope->name, __tostring->common.function_name);=0A= + }=0A= + __tostring->common.fn_flags &=3D ~ZEND_ACC_ALLOW_STATIC;=0A= + }=0A= if (__get) {=0A= if (__get->common.fn_flags & ZEND_ACC_STATIC) {=0A= zend_error(error_type, "Method %s::%s() cannot be static", = scope->name, __get->common.function_name);=0A= Index: Zend/zend_API.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_API.h,v=0A= retrieving revision 1.221=0A= diff -u -p -d -r1.221 zend_API.h=0A= --- Zend/zend_API.h 23 Sep 2005 22:49:57 -0000 1.221=0A= +++ Zend/zend_API.h 26 Sep 2005 12:13:17 -0000=0A= @@ -131,6 +131,7 @@ typedef struct _zend_function_entry {=0A= class_container.create_object =3D NULL; \=0A= class_container.interface_gets_implemented =3D NULL; \=0A= class_container.__call =3D handle_fcall; \=0A= + class_container.__tostring =3D NULL; \=0A= class_container.__get =3D handle_propget; \=0A= class_container.__set =3D handle_propset; \=0A= class_container.__unset =3D handle_propunset; \=0A= Index: Zend/zend_compile.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_compile.c,v=0A= retrieving revision 1.663=0A= diff -u -p -d -r1.663 zend_compile.c=0A= --- Zend/zend_compile.c 16 Sep 2005 13:42:31 -0000 1.663=0A= +++ Zend/zend_compile.c 26 Sep 2005 12:13:25 -0000=0A= @@ -1163,6 +1163,8 @@ void zend_do_begin_function_declaration(=0A= CG(active_class_entry)->__unset =3D (zend_function *) = CG(active_op_array);=0A= } else if ((lcname_len =3D=3D sizeof(ZEND_ISSET_FUNC_NAME)-1) && = (ZEND_U_EQUAL(Z_TYPE(function_name->u.constant), lcname, lcname_len, = ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)-1))) {=0A= CG(active_class_entry)->__isset =3D (zend_function *) = CG(active_op_array);=0A= + } else if ((lcname_len =3D=3D sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && = (ZEND_U_EQUAL(Z_TYPE(function_name->u.constant), lcname, lcname_len, = ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)-1))) {=0A= + CG(active_class_entry)->__tostring =3D (zend_function *) = CG(active_op_array);=0A= } else if (!(fn_flags & ZEND_ACC_STATIC)) {=0A= CG(active_op_array)->fn_flags |=3D ZEND_ACC_ALLOW_STATIC;=0A= }=0A= @@ -1873,6 +1875,9 @@ static void do_inherit_parent_constructo=0A= if (!ce->__call) {=0A= ce->__call =3D ce->parent->__call;=0A= }=0A= + if (!ce->__tostring) {=0A= + ce->__tostring =3D ce->parent->__tostring;=0A= + }=0A= if (!ce->clone) {=0A= ce->clone =3D ce->parent->clone;=0A= }=0A= @@ -4152,6 +4157,7 @@ ZEND_API void zend_initialize_class_data=0A= ce->__unset =3D NULL;=0A= ce->__isset =3D NULL;=0A= ce->__call =3D NULL;=0A= + ce->__tostring =3D NULL;=0A= ce->create_object =3D NULL;=0A= ce->get_iterator =3D NULL;=0A= ce->iterator_funcs.funcs =3D NULL;=0A= Index: Zend/zend_compile.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_compile.h,v=0A= retrieving revision 1.324=0A= diff -u -p -d -r1.324 zend_compile.h=0A= --- Zend/zend_compile.h 23 Sep 2005 22:55:10 -0000 1.324=0A= +++ Zend/zend_compile.h 26 Sep 2005 12:13:26 -0000=0A= @@ -723,6 +723,7 @@ END_EXTERN_C()=0A= #define ZEND_UNSET_FUNC_NAME "__unset"=0A= #define ZEND_ISSET_FUNC_NAME "__isset"=0A= #define ZEND_CALL_FUNC_NAME "__call"=0A= +#define ZEND_TOSTRING_FUNC_NAME "__tostring"=0A= #define ZEND_AUTOLOAD_FUNC_NAME "__autoload"=0A= =0A= #endif /* ZEND_COMPILE_H */=0A= Index: Zend/zend_object_handlers.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_object_handlers.c,v=0A= retrieving revision 1.146=0A= diff -u -p -d -r1.146 zend_object_handlers.c=0A= --- Zend/zend_object_handlers.c 1 Sep 2005 10:05:00 -0000 1.146=0A= +++ Zend/zend_object_handlers.c 26 Sep 2005 12:13:27 -0000=0A= @@ -1008,37 +1008,30 @@ int zend_std_object_get_class_name(zval =0A= =0A= ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval = *writeobj, int type, int should_free TSRMLS_DC)=0A= {=0A= - zval fname, *retval;=0A= + zval *retval;=0A= + zend_class_entry *ce;=0A= =0A= switch (type) {=0A= case IS_STRING:=0A= case IS_UNICODE:=0A= - if (!zend_hash_exists(&Z_OBJCE_P(readobj)->function_table, = "__tostring", sizeof("__tostring"))) {=0A= - return FAILURE;=0A= - }=0A= - ZVAL_ASCII_STRING(&fname, "__tostring", 0);=0A= - if (call_user_function_ex(NULL, &readobj, &fname, &retval, 0, NULL, = 0, NULL TSRMLS_CC) =3D=3D SUCCESS) {=0A= - if (UG(unicode)) {=0A= - zval_dtor(&fname);=0A= - }=0A= - if (retval) {=0A= - if (Z_TYPE_P(retval) !=3D (UG(unicode)?IS_UNICODE:IS_STRING)) {=0A= - zend_error(E_ERROR, "Method %v::__toString() must return a string = value", Z_OBJCE_P(readobj)->name);=0A= + ce =3D Z_OBJCE_P(readobj);=0A= + if (ce->__tostring &&=0A= + zend_call_method_with_0_params(&readobj, ce, = &ce->__tostring, "__tostring", &retval)) {=0A= + if (Z_TYPE_P(retval) =3D=3D (UG(unicode)?IS_UNICODE:IS_STRING)) {=0A= + *writeobj =3D *retval;=0A= + zval_copy_ctor(writeobj);=0A= + zval_ptr_dtor(&retval);=0A= + INIT_PZVAL(writeobj);=0A= + if (Z_TYPE_P(writeobj) !=3D type) {=0A= + convert_to_explicit_type(writeobj, type);=0A= }=0A= + return SUCCESS;=0A= } else {=0A= - MAKE_STD_ZVAL(retval);=0A= - ZVAL_ASCII_STRINGL(retval, "", 0, 1);=0A= + zval_ptr_dtor(&retval);=0A= + zend_error(E_RECOVERABLE_ERROR, "Method %v::__toString() must = return a string value", ce->name);=0A= }=0A= - *writeobj =3D *retval;=0A= - zval_copy_ctor(writeobj);=0A= - INIT_PZVAL(writeobj);=0A= - zval_ptr_dtor(&retval);=0A= - return SUCCESS;=0A= - }=0A= - if (UG(unicode)) {=0A= - zval_dtor(&fname);=0A= }=0A= - break;=0A= + return FAILURE;=0A= default:=0A= break;=0A= }=0A= @@ -1069,7 +1062,7 @@ ZEND_API zend_object_handlers std_object=0A= zend_std_object_get_class, /* get_class_entry */=0A= zend_std_object_get_class_name, /* get_class_name */=0A= zend_std_compare_objects, /* compare_objects */=0A= - NULL, /* cast_object */=0A= + zend_std_cast_object_tostring, /* cast_object */=0A= NULL, /* count_elements */=0A= };=0A= =0A= Index: Zend/zend_vm_def.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_vm_def.h,v=0A= retrieving revision 1.79=0A= diff -u -p -d -r1.79 zend_vm_def.h=0A= --- Zend/zend_vm_def.h 23 Sep 2005 09:38:36 -0000 1.79=0A= +++ Zend/zend_vm_def.h 26 Sep 2005 12:13:31 -0000=0A= @@ -884,34 +884,28 @@ ZEND_VM_HANDLER(40, ZEND_ECHO, CONST|TMP=0A= zend_free_op free_op1;=0A= zval z_copy;=0A= zval *z =3D GET_OP1_ZVAL_PTR(BP_VAR_R);=0A= + UErrorCode status =3D U_ZERO_ERROR;=0A= =0A= - if (Z_TYPE_P(z) =3D=3D IS_OBJECT && Z_OBJ_HT_P(z)->get_method !=3D = NULL &&=0A= - zend_std_cast_object_tostring(z, &z_copy, UG(unicode) ? IS_UNICODE : = IS_STRING, 0 TSRMLS_CC) =3D=3D SUCCESS) {=0A= - zend_print_variable(&z_copy);=0A= - zval_dtor(&z_copy);=0A= - } else {=0A= - UErrorCode status =3D U_ZERO_ERROR;=0A= - /* Convert inline HTML blocks to the output encoding, but only if = necessary. */=0A= - if (opline->extended_value &&=0A= - strcmp(ucnv_getName(ZEND_U_CONVERTER(UG(output_encoding_conv)), = &status),=0A= - EG(active_op_array)->script_encoding)) {=0A= - zval z_conv;=0A= - UConverter *script_enc_conv =3D NULL;=0A= - if (zend_set_converter_encoding(&script_enc_conv, = EG(active_op_array)->script_encoding) =3D=3D FAILURE) {=0A= - zend_error(E_ERROR, "Unsupported encoding [%d]", = EG(active_op_array)->script_encoding);=0A= - }=0A= - zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), = script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, = z->value.str.val, z->value.str.len, &status);=0A= - z_conv.type =3D IS_BINARY;=0A= - if (U_SUCCESS(status)) {=0A= - zend_print_variable(&z_conv);=0A= - } else {=0A= - zend_error(E_WARNING, "Could not convert inline HTML for output");=0A= - }=0A= - zval_dtor(&z_conv);=0A= - ucnv_close(script_enc_conv);=0A= + /* Convert inline HTML blocks to the output encoding, but only if = necessary. */=0A= + if (opline->extended_value &&=0A= + strcmp(ucnv_getName(ZEND_U_CONVERTER(UG(output_encoding_conv)), = &status),=0A= + EG(active_op_array)->script_encoding)) {=0A= + zval z_conv;=0A= + UConverter *script_enc_conv =3D NULL;=0A= + if (zend_set_converter_encoding(&script_enc_conv, = EG(active_op_array)->script_encoding) =3D=3D FAILURE) {=0A= + zend_error(E_ERROR, "Unsupported encoding [%d]", = EG(active_op_array)->script_encoding);=0A= + }=0A= + zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), = script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, = z->value.str.val, z->value.str.len, &status);=0A= + z_conv.type =3D IS_BINARY;=0A= + if (U_SUCCESS(status)) {=0A= + zend_print_variable(&z_conv);=0A= } else {=0A= - zend_print_variable(z);=0A= + zend_error(E_WARNING, "Could not convert inline HTML for output");=0A= }=0A= + zval_dtor(&z_conv);=0A= + ucnv_close(script_enc_conv);=0A= + } else {=0A= + zend_print_variable(z);=0A= }=0A= =0A= FREE_OP1();=0A= Index: Zend/zend_vm_execute.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_vm_execute.h,v=0A= retrieving revision 1.82=0A= diff -u -p -d -r1.82 zend_vm_execute.h=0A= --- Zend/zend_vm_execute.h 23 Sep 2005 09:38:35 -0000 1.82=0A= +++ Zend/zend_vm_execute.h 26 Sep 2005 12:13:46 -0000=0A= @@ -16,7 +16,7 @@=0A= = +----------------------------------------------------------------------+=0A= */=0A= =0A= -/* $Id: zend_vm_execute.h,v 1.82 2005/09/23 09:38:35 tony2001 Exp $ */=0A= +/* $Id: zend_vm_gen.php,v 1.13 2005/08/11 23:35:03 andrei Exp $ */=0A= =0A= static opcode_handler_t zend_user_opcode_handlers[256] =3D = {(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(op= code_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode= _handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_han= dler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler= _t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)N= ULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,= (opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opc= ode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_= handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_hand= ler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_= t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NU= LL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(= opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opco= de_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_h= andler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handl= er_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t= )NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NUL= L,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(o= pcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcod= e_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_ha= ndler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handle= r_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)= NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL= ,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(op= code_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode= _handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_han= dler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler= _t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)N= ULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,= (opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opc= ode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_= handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_hand= ler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_= t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NU= LL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(= opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opco= de_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_h= andler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handl= er_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t= )NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NUL= L,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(o= pcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcod= e_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_ha= ndler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handle= r_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)= NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL= ,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(op= code_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode= _handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_han= dler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler= _t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)N= ULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,= (opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opc= ode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_= handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_hand= ler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_= t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NU= LL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(= opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opco= de_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_h= andler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handl= er_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t= )NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NUL= L,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(o= pcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcod= e_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_ha= ndler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handle= r_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)= NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL= ,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(op= code_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode= _handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_han= dler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler= _t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)N= ULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,= (opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opc= ode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_= handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_hand= ler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_= t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NU= LL,(opcode_handler_t)NULL,(opcode_handler_t)NULL};=0A= =0A= @@ -1367,34 +1367,28 @@ static int ZEND_ECHO_SPEC_CONST_HANDLER(=0A= =0A= zval z_copy;=0A= zval *z =3D &opline->op1.u.constant;=0A= + UErrorCode status =3D U_ZERO_ERROR;=0A= =0A= - if (Z_TYPE_P(z) =3D=3D IS_OBJECT && Z_OBJ_HT_P(z)->get_method !=3D = NULL &&=0A= - zend_std_cast_object_tostring(z, &z_copy, UG(unicode) ? IS_UNICODE : = IS_STRING, 0 TSRMLS_CC) =3D=3D SUCCESS) {=0A= - zend_print_variable(&z_copy);=0A= - zval_dtor(&z_copy);=0A= - } else {=0A= - UErrorCode status =3D U_ZERO_ERROR;=0A= - /* Convert inline HTML blocks to the output encoding, but only if = necessary. */=0A= - if (opline->extended_value &&=0A= - strcmp(ucnv_getName(ZEND_U_CONVERTER(UG(output_encoding_conv)), = &status),=0A= - EG(active_op_array)->script_encoding)) {=0A= - zval z_conv;=0A= - UConverter *script_enc_conv =3D NULL;=0A= - if (zend_set_converter_encoding(&script_enc_conv, = EG(active_op_array)->script_encoding) =3D=3D FAILURE) {=0A= - zend_error(E_ERROR, "Unsupported encoding [%d]", = EG(active_op_array)->script_encoding);=0A= - }=0A= - zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), = script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, = z->value.str.val, z->value.str.len, &status);=0A= - z_conv.type =3D IS_BINARY;=0A= - if (U_SUCCESS(status)) {=0A= - zend_print_variable(&z_conv);=0A= - } else {=0A= - zend_error(E_WARNING, "Could not convert inline HTML for output");=0A= - }=0A= - zval_dtor(&z_conv);=0A= - ucnv_close(script_enc_conv);=0A= + /* Convert inline HTML blocks to the output encoding, but only if = necessary. */=0A= + if (opline->extended_value &&=0A= + strcmp(ucnv_getName(ZEND_U_CONVERTER(UG(output_encoding_conv)), = &status),=0A= + EG(active_op_array)->script_encoding)) {=0A= + zval z_conv;=0A= + UConverter *script_enc_conv =3D NULL;=0A= + if (zend_set_converter_encoding(&script_enc_conv, = EG(active_op_array)->script_encoding) =3D=3D FAILURE) {=0A= + zend_error(E_ERROR, "Unsupported encoding [%d]", = EG(active_op_array)->script_encoding);=0A= + }=0A= + zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), = script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, = z->value.str.val, z->value.str.len, &status);=0A= + z_conv.type =3D IS_BINARY;=0A= + if (U_SUCCESS(status)) {=0A= + zend_print_variable(&z_conv);=0A= } else {=0A= - zend_print_variable(z);=0A= + zend_error(E_WARNING, "Could not convert inline HTML for output");=0A= }=0A= + zval_dtor(&z_conv);=0A= + ucnv_close(script_enc_conv);=0A= + } else {=0A= + zend_print_variable(z);=0A= }=0A= =0A= ZEND_VM_NEXT_OPCODE();=0A= @@ -3879,34 +3873,28 @@ static int ZEND_ECHO_SPEC_TMP_HANDLER(ZE=0A= zend_free_op free_op1;=0A= zval z_copy;=0A= zval *z =3D _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 = TSRMLS_CC);=0A= + UErrorCode status =3D U_ZERO_ERROR;=0A= =0A= - if (Z_TYPE_P(z) =3D=3D IS_OBJECT && Z_OBJ_HT_P(z)->get_method !=3D = NULL &&=0A= - zend_std_cast_object_tostring(z, &z_copy, UG(unicode) ? IS_UNICODE : = IS_STRING, 0 TSRMLS_CC) =3D=3D SUCCESS) {=0A= - zend_print_variable(&z_copy);=0A= - zval_dtor(&z_copy);=0A= - } else {=0A= - UErrorCode status =3D U_ZERO_ERROR;=0A= - /* Convert inline HTML blocks to the output encoding, but only if = necessary. */=0A= - if (opline->extended_value &&=0A= - strcmp(ucnv_getName(ZEND_U_CONVERTER(UG(output_encoding_conv)), = &status),=0A= - EG(active_op_array)->script_encoding)) {=0A= - zval z_conv;=0A= - UConverter *script_enc_conv =3D NULL;=0A= - if (zend_set_converter_encoding(&script_enc_conv, = EG(active_op_array)->script_encoding) =3D=3D FAILURE) {=0A= - zend_error(E_ERROR, "Unsupported encoding [%d]", = EG(active_op_array)->script_encoding);=0A= - }=0A= - zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), = script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, = z->value.str.val, z->value.str.len, &status);=0A= - z_conv.type =3D IS_BINARY;=0A= - if (U_SUCCESS(status)) {=0A= - zend_print_variable(&z_conv);=0A= - } else {=0A= - zend_error(E_WARNING, "Could not convert inline HTML for output");=0A= - }=0A= - zval_dtor(&z_conv);=0A= - ucnv_close(script_enc_conv);=0A= + /* Convert inline HTML blocks to the output encoding, but only if = necessary. */=0A= + if (opline->extended_value &&=0A= + strcmp(ucnv_getName(ZEND_U_CONVERTER(UG(output_encoding_conv)), = &status),=0A= + EG(active_op_array)->script_encoding)) {=0A= + zval z_conv;=0A= + UConverter *script_enc_conv =3D NULL;=0A= + if (zend_set_converter_encoding(&script_enc_conv, = EG(active_op_array)->script_encoding) =3D=3D FAILURE) {=0A= + zend_error(E_ERROR, "Unsupported encoding [%d]", = EG(active_op_array)->script_encoding);=0A= + }=0A= + zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), = script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, = z->value.str.val, z->value.str.len, &status);=0A= + z_conv.type =3D IS_BINARY;=0A= + if (U_SUCCESS(status)) {=0A= + zend_print_variable(&z_conv);=0A= } else {=0A= - zend_print_variable(z);=0A= + zend_error(E_WARNING, "Could not convert inline HTML for output");=0A= }=0A= + zval_dtor(&z_conv);=0A= + ucnv_close(script_enc_conv);=0A= + } else {=0A= + zend_print_variable(z);=0A= }=0A= =0A= zval_dtor(free_op1.var);=0A= @@ -6930,34 +6918,28 @@ static int ZEND_ECHO_SPEC_VAR_HANDLER(ZE=0A= zend_free_op free_op1;=0A= zval z_copy;=0A= zval *z =3D _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 = TSRMLS_CC);=0A= + UErrorCode status =3D U_ZERO_ERROR;=0A= =0A= - if (Z_TYPE_P(z) =3D=3D IS_OBJECT && Z_OBJ_HT_P(z)->get_method !=3D = NULL &&=0A= - zend_std_cast_object_tostring(z, &z_copy, UG(unicode) ? IS_UNICODE : = IS_STRING, 0 TSRMLS_CC) =3D=3D SUCCESS) {=0A= - zend_print_variable(&z_copy);=0A= - zval_dtor(&z_copy);=0A= - } else {=0A= - UErrorCode status =3D U_ZERO_ERROR;=0A= - /* Convert inline HTML blocks to the output encoding, but only if = necessary. */=0A= - if (opline->extended_value &&=0A= - strcmp(ucnv_getName(ZEND_U_CONVERTER(UG(output_encoding_conv)), = &status),=0A= - EG(active_op_array)->script_encoding)) {=0A= - zval z_conv;=0A= - UConverter *script_enc_conv =3D NULL;=0A= - if (zend_set_converter_encoding(&script_enc_conv, = EG(active_op_array)->script_encoding) =3D=3D FAILURE) {=0A= - zend_error(E_ERROR, "Unsupported encoding [%d]", = EG(active_op_array)->script_encoding);=0A= - }=0A= - zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), = script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, = z->value.str.val, z->value.str.len, &status);=0A= - z_conv.type =3D IS_BINARY;=0A= - if (U_SUCCESS(status)) {=0A= - zend_print_variable(&z_conv);=0A= - } else {=0A= - zend_error(E_WARNING, "Could not convert inline HTML for output");=0A= - }=0A= - zval_dtor(&z_conv);=0A= - ucnv_close(script_enc_conv);=0A= + /* Convert inline HTML blocks to the output encoding, but only if = necessary. */=0A= + if (opline->extended_value &&=0A= + strcmp(ucnv_getName(ZEND_U_CONVERTER(UG(output_encoding_conv)), = &status),=0A= + EG(active_op_array)->script_encoding)) {=0A= + zval z_conv;=0A= + UConverter *script_enc_conv =3D NULL;=0A= + if (zend_set_converter_encoding(&script_enc_conv, = EG(active_op_array)->script_encoding) =3D=3D FAILURE) {=0A= + zend_error(E_ERROR, "Unsupported encoding [%d]", = EG(active_op_array)->script_encoding);=0A= + }=0A= + zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), = script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, = z->value.str.val, z->value.str.len, &status);=0A= + z_conv.type =3D IS_BINARY;=0A= + if (U_SUCCESS(status)) {=0A= + zend_print_variable(&z_conv);=0A= } else {=0A= - zend_print_variable(z);=0A= + zend_error(E_WARNING, "Could not convert inline HTML for output");=0A= }=0A= + zval_dtor(&z_conv);=0A= + ucnv_close(script_enc_conv);=0A= + } else {=0A= + zend_print_variable(z);=0A= }=0A= =0A= if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};=0A= @@ -19709,34 +19691,28 @@ static int ZEND_ECHO_SPEC_CV_HANDLER(ZEN=0A= =0A= zval z_copy;=0A= zval *z =3D _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC);=0A= + UErrorCode status =3D U_ZERO_ERROR;=0A= =0A= - if (Z_TYPE_P(z) =3D=3D IS_OBJECT && Z_OBJ_HT_P(z)->get_method !=3D = NULL &&=0A= - zend_std_cast_object_tostring(z, &z_copy, UG(unicode) ? IS_UNICODE : = IS_STRING, 0 TSRMLS_CC) =3D=3D SUCCESS) {=0A= - zend_print_variable(&z_copy);=0A= - zval_dtor(&z_copy);=0A= - } else {=0A= - UErrorCode status =3D U_ZERO_ERROR;=0A= - /* Convert inline HTML blocks to the output encoding, but only if = necessary. */=0A= - if (opline->extended_value &&=0A= - strcmp(ucnv_getName(ZEND_U_CONVERTER(UG(output_encoding_conv)), = &status),=0A= - EG(active_op_array)->script_encoding)) {=0A= - zval z_conv;=0A= - UConverter *script_enc_conv =3D NULL;=0A= - if (zend_set_converter_encoding(&script_enc_conv, = EG(active_op_array)->script_encoding) =3D=3D FAILURE) {=0A= - zend_error(E_ERROR, "Unsupported encoding [%d]", = EG(active_op_array)->script_encoding);=0A= - }=0A= - zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), = script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, = z->value.str.val, z->value.str.len, &status);=0A= - z_conv.type =3D IS_BINARY;=0A= - if (U_SUCCESS(status)) {=0A= - zend_print_variable(&z_conv);=0A= - } else {=0A= - zend_error(E_WARNING, "Could not convert inline HTML for output");=0A= - }=0A= - zval_dtor(&z_conv);=0A= - ucnv_close(script_enc_conv);=0A= + /* Convert inline HTML blocks to the output encoding, but only if = necessary. */=0A= + if (opline->extended_value &&=0A= + strcmp(ucnv_getName(ZEND_U_CONVERTER(UG(output_encoding_conv)), = &status),=0A= + EG(active_op_array)->script_encoding)) {=0A= + zval z_conv;=0A= + UConverter *script_enc_conv =3D NULL;=0A= + if (zend_set_converter_encoding(&script_enc_conv, = EG(active_op_array)->script_encoding) =3D=3D FAILURE) {=0A= + zend_error(E_ERROR, "Unsupported encoding [%d]", = EG(active_op_array)->script_encoding);=0A= + }=0A= + zend_convert_encodings(ZEND_U_CONVERTER(UG(output_encoding_conv)), = script_enc_conv, &z_conv.value.str.val, &z_conv.value.str.len, = z->value.str.val, z->value.str.len, &status);=0A= + z_conv.type =3D IS_BINARY;=0A= + if (U_SUCCESS(status)) {=0A= + zend_print_variable(&z_conv);=0A= } else {=0A= - zend_print_variable(z);=0A= + zend_error(E_WARNING, "Could not convert inline HTML for output");=0A= }=0A= + zval_dtor(&z_conv);=0A= + ucnv_close(script_enc_conv);=0A= + } else {=0A= + zend_print_variable(z);=0A= }=0A= =0A= ZEND_VM_NEXT_OPCODE();=0A= Index: Zend/zend_vm_opcodes.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_vm_opcodes.h,v=0A= retrieving revision 1.59=0A= diff -u -p -d -r1.59 zend_vm_opcodes.h=0A= --- Zend/zend_vm_opcodes.h 23 Sep 2005 09:38:37 -0000 1.59=0A= +++ Zend/zend_vm_opcodes.h 26 Sep 2005 12:13:46 -0000=0A= @@ -16,7 +16,7 @@=0A= = +----------------------------------------------------------------------+=0A= */=0A= =0A= -/* $Id: zend_vm_opcodes.h,v 1.59 2005/09/23 09:38:37 tony2001 Exp $ */=0A= +/* $Id: zend_vm_gen.php,v 1.13 2005/08/11 23:35:03 andrei Exp $ */=0A= =0A= #define ZEND_NOP 0=0A= #define ZEND_ADD 1=0A= ------=_NextPart_000_0006_01C5C2ED.6825E9C0--