Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9586 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14664 invoked by uid 1010); 27 Apr 2004 12:42:31 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 14612 invoked from network); 27 Apr 2004 12:42:31 -0000 Received: from unknown (HELO mail.internet-factory.de) (62.134.147.34) by pb1.pair.com with SMTP; 27 Apr 2004 12:42:31 -0000 Received: from pharao.lammfellpuschen.de (pD9E56A42.dip.t-dialin.net [217.229.106.66]) by mail.internet-factory.de (8.12.8/8.12.8) with SMTP id i3RCg6GI014315; Tue, 27 Apr 2004 14:42:06 +0200 Received: by pharao.lammfellpuschen.de (sSMTP sendmail emulation); Tue, 27 Apr 2004 14:42:06 +0200 Date: Tue, 27 Apr 2004 14:42:05 +0200 To: Marcus Boerger Cc: Christian Schneider , Andi Gutmans , Curt Zirzow , internals@lists.php.net Message-ID: <20040427124205.GE5184@pharao.serveftp.org> Reply-To: messju mohr References: <20040427034900.GA31042@bagend.shire> <5.1.0.14.2.20040427104915.02509f58@127.0.0.1> <408E33F4.6050902@cschneid.com> <1719688150.20040427132507@marcus-boerger.de> <408E4557.4010303@cschneid.com> <271302336.20040427141643@marcus-boerger.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <271302336.20040427141643@marcus-boerger.de> User-Agent: Mutt/1.4.2.1i X-WebServ-IT-MailScanner-Information: Please contact the ISP for more information X-WebServ-IT-MailScanner: Found to be clean X-WebServ-IT-MailScanner-SpamCheck: not spam, SpamAssassin (score=-5.563, required 5, AWL -7.00, BAYES_00 -4.90, RCVD_IN_DYNABLOCK 2.60, RCVD_IN_NJABL 0.10, RCVD_IN_NJABL_DIALUP 3.54, RCVD_IN_SORBS 0.10) X-MailScanner-From: messju@lammfellpuschen.de Subject: Re: [PHP-DEV] Illegal use of string offset From: messju@lammfellpuschen.de (messju mohr) On Tue, Apr 27, 2004 at 02:16:43PM +0200, Marcus Boerger wrote: > Hello Christian, > > Tuesday, April 27, 2004, 1:34:47 PM, you wrote: > > > Marcus Boerger wrote: > >>>[ $a = 'foo'; $a['bar'] = 42; has an even weirder behaviour: It results > >>>in the string '4oo'... ] > >> > >> That's a pretty. It is using 'bar' as a sting index to 'foo' and to do > >> this it needs to convert 'bar' to an integer. The rest is obvious. > > > So you find it obvious that 42 is cast to string and the first character > > is used as replacement? Wasn't obvious to me before I tried it :-) > > That's what i meant it confuses far too many people and doesn't even make > real sense. For example converting 42 into chr(42) and setting it would > follow the same autoconversion logic. Hence a hint of kind E_STRICT would > be very good. I know I have no karma here, but anyway: If you want to give people a hinting they access their stuff in a wrong way *and* you want it in a consistent way: why not throw an E_STRICT (or maybe even an E_NOTICE) when accessing anything via [] that is not array? $a = null; $a['foo']; -> should give an E_STRICT (if not an E_NOTICE) $a = false; $a['foo']; -> should give an E_STRICT (if not an E_NOTICE) $a = "FOO"; $a['foo']; -> should give an E_STRICT (if not an E_NOTICE) $a = array(); $a['foo']; -> gives an E_NOTICE because of "undefined index 'foo'" $a = array('foo'=>'FOO'); $a['foo'] -> obviously okay just my few p. messju > marcus