Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21702 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80736 invoked by uid 1010); 27 Jan 2006 15:17:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 80719 invoked from network); 27 Jan 2006 15:17:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jan 2006 15:17:49 -0000 X-Host-Fingerprint: 212.227.126.183 moutng.kundenserver.de Received: from ([212.227.126.183:54609] helo=moutng.kundenserver.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id B6/87-03249-C993AD34 for ; Fri, 27 Jan 2006 10:17:48 -0500 Received: from [213.23.166.225] (helo=compunix.piddelpaddel.de) by mrelayeu.kundenserver.de (node=mrelayeu5) with ESMTP (Nemesis), id 0ML25U-1F2VM82pou-0001QE; Fri, 27 Jan 2006 16:17:45 +0100 To: internals@lists.php.net Date: Fri, 27 Jan 2006 16:17:39 +0100 User-Agent: KMail/1.9.1 References: <1728334199.20050925143657@marcus-boerger.de> <90e24d4e0601261554h4029db47n9d413bca414551aa@mail.gmail.com> <777983234.20060127082216@marcus-boerger.de> In-Reply-To: <777983234.20060127082216@marcus-boerger.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200601271617.40669.tm@ippfp.org> X-Provags-ID: kundenserver.de abuse@kundenserver.de login:aa225b5806905afbf14d50f30346eb07 Subject: Re: [PHP-DEV] [PATCH] __toString() From: tm@ippfp.org (Thomas Moenicke) Marcus Boerger wrote: > Hello Jeremy, > > it is supposed to work everywhere in head and will be available in 5.2. > Is there a generic way (for extensions, of course) to override the operators between objects implementing __toString()? See, I have two objects: $o1 = new QString("php"); $o2 = new QString("-internals"); Now I could do: $result = $o1->operator+=($o2); better would be: $result = $o1 .= $o2; should result in "php-internals" Can I modify the object structure in any way to register my own operator functions which can be called by the engines execution unit? I found only hard-wired implementations of that if I looked into the 'zend execute' code or maybe I'm wrong. Ideally there would be something like a pointer in every zval which points to a struct or table of 'operator-function pointers'. In this case I could override it and point to another operator-function pointer table. Ok, I can dream ;-) In the current implementation (php 5.1) a function zend_make_printable' is called, and there zend_std_cast_object_tostring. This means that the objects __toString() result will be passed to the underlying system, and there is no unicode support yet. What I would prefer is calling overidden operators before __toString() is called. Am I wrong? Can anybody help me please? Thanks, Thomas