Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9581 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 668 invoked by uid 1010); 27 Apr 2004 09:15:57 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 632 invoked from network); 27 Apr 2004 09:15:57 -0000 Received: from unknown (HELO shiva.mind.de) (212.42.230.204) by pb1.pair.com with SMTP; 27 Apr 2004 09:15:57 -0000 Received: from BAUMBART (pD95F88DE.dip.t-dialin.net [217.95.136.222]) by shiva.mind.de (Postfix) with ESMTP id AC0F197B4F; Tue, 27 Apr 2004 11:15:55 +0200 (CEST) Date: Tue, 27 Apr 2004 11:16:03 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <133217930.20040427111603@marcus-boerger.de> To: Andi Gutmans Cc: Curt Zirzow , internals@lists.php.net In-Reply-To: <5.1.0.14.2.20040427104915.02509f58@127.0.0.1> References: <20040427034900.GA31042@bagend.shire> <5.1.0.14.2.20040427104915.02509f58@127.0.0.1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Illegal use of string offset From: helly@php.net (Marcus Boerger) Hello Andi, be strict marcus Tuesday, April 27, 2004, 9:51:35 AM, you wrote: > 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; >>