Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9575 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82682 invoked by uid 1010); 27 Apr 2004 03:46:25 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 82591 invoked from network); 27 Apr 2004 03:46:25 -0000 Received: from unknown (HELO took.shire) (68.125.111.51) by pb1.pair.com with SMTP; 27 Apr 2004 03:46:25 -0000 Received: (qmail 39740 invoked by uid 1001); 27 Apr 2004 03:49:00 -0000 Date: Tue, 27 Apr 2004 03:49:00 +0000 To: internals@lists.php.net Message-ID: <20040427034900.GA31042@bagend.shire> Mail-Followup-To: internals@lists.php.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Subject: Illegal use of string offset From: curt@php.net (Curt Zirzow) 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."