Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9582 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87989 invoked by uid 1010); 27 Apr 2004 10:20:40 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 87933 invoked from network); 27 Apr 2004 10:20:39 -0000 Received: from unknown (HELO xaxa.search.ch) (195.141.85.117) by pb1.pair.com with SMTP; 27 Apr 2004 10:20:39 -0000 Received: from localhost (localhost [127.0.0.1]) by xaxa.search.ch (Postfix) with ESMTP id 56EFC6CFB4; Tue, 27 Apr 2004 12:20:39 +0200 (CEST) Received: by xaxa.search.ch (Postfix, from userid 65534) id 48B036CFB6; Tue, 27 Apr 2004 12:20:38 +0200 (CEST) Received: from cschneid.com (ultrafilter-i [192.168.85.2]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by xaxa.search.ch (Postfix) with ESMTP id 9A5266CFB4; Tue, 27 Apr 2004 12:20:37 +0200 (CEST) Message-ID: <408E33F4.6050902@cschneid.com> Date: Tue, 27 Apr 2004 12:20:36 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040114 X-Accept-Language: en-us, en, de-ch MIME-Version: 1.0 To: Andi Gutmans Cc: Curt Zirzow , internals@lists.php.net References: <20040427034900.GA31042@bagend.shire> <5.1.0.14.2.20040427104915.02509f58@127.0.0.1> In-Reply-To: <5.1.0.14.2.20040427104915.02509f58@127.0.0.1> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on xaxa.search.ch X-Spam-Level: X-Spam-Status: No, hits=-4.9 required=5.0 tests=BAYES_00 autolearn=ham version=2.63 X-Virus-Scanned: by AMaViS 0.3.12pre8 Subject: Re: [PHP-DEV] Illegal use of string offset From: cschneid@cschneid.com (Christian Schneider) Andi Gutmans wrote: > I made this change back in December. > I guess I could revert back but I think it makes sense to be strict here. Reevaluating it I noted the following: $a = 'foo'; $a['bar']['qux'] = 42; # error $a = 42; $a['bar']['qux'] = 42; # warning $a = true; $a['bar']['qux'] = 42; # warning unset($a); $a['bar']['qux'] = 42; # works $a = null; $a['bar']['qux'] = 42; # works $a = false; $a['bar']['qux'] = 42; # works! On the other hand $a = 'foo'; $b = $a['bar']['qux']; # error $a = 42; $b = $a['bar']['qux']; # works $a = true; $b = $a['bar']['qux']; # works unset($a); $b = $a['bar']['qux']; # works $a = null; $b = $a['bar']['qux']; # works $a = false; $b = $a['bar']['qux']; # works Let me ask you one question: What it the *real* benefit of making it fail? Isn't a notice or warning enough safety? I think this should definitely be more orthogonal, i.e. work (with a notice or warning) in all cases to avoid WTF. [ $a = 'foo'; $a['bar'] = 42; has an even weirder behaviour: It results in the string '4oo'... ] - Chris