Re: Illegal use of string offset

From: Date: Tue, 27 Apr 2004 06:37:18 +0000
Subject: Re: Illegal use of string offset
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-9576@lists.php.net to get a copy of this message
On Tue, 27 Apr 2004, 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? I see no reason why PHP shouldn't stop in this case. You're definitely doing something wrong to create that E_ERROR. Derick

« previous php.internals (#9576) next »