Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9577 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42272 invoked by uid 1010); 27 Apr 2004 07:51:47 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 42228 invoked from network); 27 Apr 2004 07:51:46 -0000 Received: from unknown (HELO mail.zend.com) (192.117.235.230) by pb1.pair.com with SMTP; 27 Apr 2004 07:51:46 -0000 Received: (qmail 20048 invoked from network); 27 Apr 2004 07:51:44 -0000 Received: from localhost (HELO AndiNotebook.zend.com) (127.0.0.1) by localhost with SMTP; 27 Apr 2004 07:51:44 -0000 Message-ID: <5.1.0.14.2.20040427104915.02509f58@127.0.0.1> X-Sender: andi@127.0.0.1 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Tue, 27 Apr 2004 10:51:35 +0300 To: Curt Zirzow ,internals@lists.php.net In-Reply-To: <20040427034900.GA31042@bagend.shire> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] Illegal use of string offset From: andi@zend.com (Andi Gutmans) References: <20040427034900.GA31042@bagend.shire> I made this change back in December. I guess I could revert back but I think it makes sense to be strict here. What does the rest think? Andi At 03:49 AM 4/27/2004 +0000, Curt Zirzow wrote: >I can't seem to find any discussion on this BC issue, so forgive me if >this has already been discussed. > >Given the following; > >$a = 'a string'; > >/* E_ERROR Cannot use string offset as an array */ >echo is_array($a['bar']['baz']); > >/* non error resolution */ >echo isset($a['bar']['baz']) && is_array($a['bar']['baz']); > > >I'm not sure, but the patch below does seem to make the E_ERROR >get demoted to a E_WARNING, thus fixing it so execution simply doesn't >stop when a string is referenced improperly. Or is it a *must* that php >needs to stop in this case? > > >Index: zend_execute.c >=================================================================== >RCS file: /repository/ZendEngine2/zend_execute.c,v >retrieving revision 1.643 >diff -u -r1.643 zend_execute.c >--- zend_execute.c 15 Apr 2004 21:32:34 -0000 1.643 >+++ zend_execute.c 27 Apr 2004 02:39:52 -0000 >@@ -898,7 +898,9 @@ > zval ***retval = &T(result->u.var).var.ptr_ptr; > > if (!container_ptr) { >- zend_error(E_ERROR, "Cannot use string offset as an array"); >+ *retval = &EG(uninitialized_zval_ptr); >+ zend_error(E_WARNING, "Cannot use string offset as an array"); >+ return; > } > > container = *container_ptr; > > > >Curt >-- >"I used to think I was indecisive, but now I'm not so sure." > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php