Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23905 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70284 invoked by uid 1010); 4 Jun 2006 03:20:21 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 70269 invoked from network); 4 Jun 2006 03:20:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jun 2006 03:20:21 -0000 X-PHP-List-Original-Sender: cellog@php.net X-Host-Fingerprint: 66.79.163.178 bluga.net Linux 2.5 (sometimes 2.4) (4) Received: from ([66.79.163.178:42592] helo=mail.bluga.net) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id E8/B7-49656-37152844 for ; Sat, 03 Jun 2006 23:20:19 -0400 Received: from mail.bluga.net (mail.bluga.net [127.0.0.1]) by mail.bluga.net (Postfix) with ESMTP id 956DF27C97; Sat, 3 Jun 2006 20:28:30 -0700 (PDT) Received: from [192.168.0.103] (CPE-24-208-79-238.neb.res.rr.com [24.208.79.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bluga.net (Postfix) with ESMTP id 5F37527C6A; Sat, 3 Jun 2006 20:28:28 -0700 (PDT) Message-ID: <4482516B.70007@php.net> Date: Sat, 03 Jun 2006 22:20:11 -0500 User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Marcus Boerger Cc: internals@lists.php.net, Dmitry Stogov , Andi Gutmans , Zeev Suraski , Ilia Alshanetsky References: <795156743.20060603134212@marcus-boerger.de> In-Reply-To: <795156743.20060603134212@marcus-boerger.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: Re: Missing __toString() part From: cellog@php.net (Greg Beaver) Marcus Boerger wrote: > Hello guys, > > the attached patch closes one more __toString() part. It allows > to use objects that define __toString as indexes to arrays. What do > you guys think about this, should we add it or stay with the old > behavior that didn't allow objects as indexes at all. I prefer to require an explicit (string) cast to use an object as an array index. The "can't use objects as array index" has actually helped me catch many subtle bugs that were slipping through in earlier PHP versions, I very much like this fatal error. I don't see this: $a = $b[$c]; being much clearer to understand than: $a = $b[$c]; or better yet $a = $b[$c->person()]; which is by far the clearest and easiest to debug (and results in a fatal error if $c is the wrong kind of object or the wrong string - even better for debugging) Thanks, Greg