Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_2) / zend_API.c

From: Date: Sat, 13 May 2006 10:46:32 +0000
Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_2) / zend_API.c
References: 1  Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-4878@lists.php.net to get a copy of this message
Hello Marcus, in case someone wonderes, the '#if 1||MBO_0' has been there as a marker since i was not sure i did all correct in that blocl. However i tested now using 'valgrind sapi/cli/php run-tests.php ext/spl_types/tests/006.phpt' and it works in head and 5.2. best regards marcus Saturday, May 13, 2006, 12:37:45 PM, you wrote: > helly Sat May 13 10:37:45 2006 UTC > Modified files: (Branch: PHP_5_2) > /ZendEngine2 zend_API.c > Log: > - MFH code layout for __toString() use in parameter parsing api > > > > http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_API.c?r1=1.296.2.27.2.6&r2=1.296.2.27.2.7&diff_format=u > Index: ZendEngine2/zend_API.c > diff -u ZendEngine2/zend_API.c:1.296.2.27.2.6 > ZendEngine2/zend_API.c:1.296.2.27.2.7 > --- ZendEngine2/zend_API.c:1.296.2.27.2.6 Fri May 12 00:21:00 2006 > +++ ZendEngine2/zend_API.c Sat May 13 10:37:45 2006 > @@ -5,7 +5,7 @@ > | Copyright (c) 1998-2006 Zend Technologies Ltd. (http://www.zend.com) | > +----------------------------------------------------------------------+ > | This source file is subject to version 2.00 of the Zend license, | > - | that is bundled with this package in the file LICENSE, and is | > + | that is bundled with this package in the file LICENSE, and is | > | available through the world-wide-web at the following url: | > | http://www.zend.com/license/2_00.txt. > | > | If you did not receive a copy of the Zend license and are unable to | > @@ -18,7 +18,7 @@ > +----------------------------------------------------------------------+ > */ > > -/* $Id: zend_API.c,v 1.296.2.27.2.6 2006/05/12 00:21:00 helly Exp $ */ > +/* $Id: zend_API.c,v 1.296.2.27.2.7 2006/05/13 10:37:45 helly Exp $ */ > > #include "zend.h" > #include "zend_execute.h" > @@ -251,6 +251,44 @@ > return 0; > } > > +static int parse_arg_object_to_string(zval **arg, char **p, int *pl, int type TSRMLS_DC) > +{ > + if (Z_OBJ_HANDLER_PP(arg, cast_object)) { > + SEPARATE_ZVAL_IF_NOT_REF(arg); > + if (Z_OBJ_HANDLER_PP(arg, cast_object)(*arg, *arg, type TSRMLS_CC) == SUCCESS) > { > + *pl = Z_STRLEN_PP(arg); > + *p = Z_STRVAL_PP(arg); > + return SUCCESS; > + } > + } > + /* Standard PHP objects */ > + if (Z_OBJ_HT_PP(arg) == &std_object_handlers || > !Z_OBJ_HANDLER_PP(arg, cast_object)) { > + SEPARATE_ZVAL_IF_NOT_REF(arg); > + if (zend_std_cast_object_tostring(*arg, *arg, type TSRMLS_CC) == SUCCESS) { > + *pl = Z_STRLEN_PP(arg); > + *p = Z_STRVAL_PP(arg); > + return SUCCESS; > + } > + } > + if (!Z_OBJ_HANDLER_PP(arg, cast_object) && Z_OBJ_HANDLER_PP(arg, get)) { > + int use_copy; > + zval *z = Z_OBJ_HANDLER_PP(arg, get)(*arg TSRMLS_CC); > + z->refcount++; > + if(Z_TYPE_P(z) != IS_OBJECT) { > + zval_dtor(*arg); > + Z_TYPE_P(*arg) = IS_NULL; > + zend_make_printable_zval(z, *arg, &use_copy); > + if (!use_copy) { > + ZVAL_ZVAL(*arg, z, 1, 1); > + } > + *pl = Z_STRLEN_PP(arg); > + *p = Z_STRVAL_PP(arg); > + return SUCCESS; > + } > + zval_ptr_dtor(&z); > + } > + return FAILURE; > +} > > static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **spec TSRMLS_DC) > { > @@ -358,45 +396,10 @@ > *pl = Z_STRLEN_PP(arg); > break; > > - case IS_OBJECT: { > - if (Z_OBJ_HANDLER_PP(arg, cast_object)) { > - SEPARATE_ZVAL_IF_NOT_REF(arg); > - if > (Z_OBJ_HANDLER_PP(arg, cast_object)(*arg, *arg, IS_STRING TSRMLS_CC) == SUCCESS) { > - *pl = Z_STRLEN_PP(arg); > - *p = Z_STRVAL_PP(arg); > - break; > - } > - } > - /* Standard PHP objects */ > - if (Z_OBJ_HT_PP(arg) == > &std_object_handlers || !Z_OBJ_HANDLER_PP(arg, cast_object)) { > - SEPARATE_ZVAL_IF_NOT_REF(arg); > - if > (zend_std_cast_object_tostring(*arg, *arg, IS_STRING TSRMLS_CC) == SUCCESS) { > - *pl = Z_STRLEN_PP(arg); > - *p = Z_STRVAL_PP(arg); > - break; > - } > - } > -#if 1||MBO_0 > - if > (!Z_OBJ_HANDLER_PP(arg, cast_object) && Z_OBJ_HANDLER_PP(arg, get)) { > - int use_copy; > - zval *z = > Z_OBJ_HANDLER_PP(arg, get)(*arg TSRMLS_CC); > - > - z->refcount++; > - if(Z_TYPE_P(z) != IS_OBJECT) { > - zval_dtor(*arg); > - Z_TYPE_P(*arg) = IS_NULL; > - > zend_make_printable_zval(z, *arg, &use_copy); > - if (!use_copy) { > - ZVAL_ZVAL(*arg, z, 1, > 1); > - } > - *pl = Z_STRLEN_PP(arg); > - *p = Z_STRVAL_PP(arg); > - break; > - } > - zval_ptr_dtor(&z); > + case IS_OBJECT: > + if > (parse_arg_object_to_string(arg, p, pl, IS_STRING TSRMLS_CC) == SUCCESS) { > + break; > } > -#endif > - } > > case IS_ARRAY: > case IS_RESOURCE: Best regards, Marcus

« previous php.zend-engine.cvs (#4878) next »