Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19903 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20907 invoked by uid 1010); 4 Nov 2005 08:28:30 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 20892 invoked from network); 4 Nov 2005 08:28:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Nov 2005 08:28:30 -0000 X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:52638] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 26/AA-19819-DAB1B634 for ; Fri, 04 Nov 2005 03:28:30 -0500 Received: from [192.168.1.3] (dslb-084-063-021-027.pools.arcor-ip.net [84.63.21.27]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id 48FF7610283; Fri, 4 Nov 2005 09:32:26 +0100 (CET) Date: Fri, 4 Nov 2005 09:28:36 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1214236612.20051104092836@marcus-boerger.de> To: Bob Silva Cc: internals@lists.php.net In-Reply-To: <000101c5e116$a7f3ccb0$5d54edc6@jake> References: <000101c5e116$a7f3ccb0$5d54edc6@jake> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [PATCH] - Standardize argument parsing of objects From: helly@php.net (Marcus Boerger) Hello Bob, this is a) wrong in the way you call the cast handler and b) we will definitively not add this behavior before the next major release aka HEAD. However it would be better to call the conversion functions (zend_operators.h) here to have get handler used when no cast handler is available to avoid inconsistencies with auto conversions in other places. I guess I know where you're heading, i am not quite sure this is essantial or even the rigth thing to for PHP yet at least for stuff like the array functions and objects that overload ArrayAccess it is more than usefull. regards marcus p.s.: You still haven't shown me any of your extension code :-/ Friday, November 4, 2005, 9:06:27 AM, you wrote: > --- zend_API.c 2005-11-03 20:26:02.000000000 -0800 > +++ zend_API.c 2005-11-03 20:26:02.000000000 -0800 > @@ -312,8 +312,17 @@ > *p = Z_LVAL_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_LONG, 0 TSRMLS_CC) == SUCCESS) { > + *p = Z_LVAL_PP(arg); > + break; > + } > + } > + } > + > case IS_ARRAY: > - case IS_OBJECT: > case IS_RESOURCE: > default: > return "long"; > @@ -346,8 +355,17 @@ > *p = Z_DVAL_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_DOUBLE, 0 TSRMLS_CC) == SUCCESS) { > + *p = Z_DVAL_PP(arg); > + break; > + } > + } > + } > + > case IS_ARRAY: > - case IS_OBJECT: > case IS_RESOURCE: > default: > return "double"; > @@ -408,8 +426,17 @@ > *p = Z_BVAL_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_BOOL, 0 TSRMLS_CC) == SUCCESS) { > + *p = Z_BVAL_PP(arg); > + break; > + } > + } > + } > + > case IS_ARRAY: > - case IS_OBJECT: > case IS_RESOURCE: > default: > return "boolean"; > @@ -434,6 +461,15 @@ > case 'a': > { > zval **p = va_arg(*va, zval **); > + if (Z_TYPE_PP(arg) == 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_ARRAY, 0 TSRMLS_CC) == SUCCESS) { > + *p = *arg; > + break; > + } > + } > + } > if (Z_TYPE_PP(arg) != IS_ARRAY) { > if (Z_TYPE_PP(arg) == IS_NULL && return_null) { > *p = NULL; Best regards, Marcus