ID: 14066
Updated by: [EMAIL PROTECTED]
-Summary: Can't suppress warnigns on accessing invalid string
offset
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: Scripting Engine problem
Operating System: Any
PHP Version: 4.0CVS-2001-11-15
New Comment:
I'm not satisfied with this answer :-)
Why does it work with arrays but not with strings (and, bert, yeah I
know they aren't the same).
Just because "it's strings here" doesn't legitimate that a warnings is
thrown. Using your suggestion is rather cumbersome.
Is it an implemention issue? Can it be solve to be less long winded?
"it is"
a bug imho :)
Previous Comments:
------------------------------------------------------------------------
[2002-03-03 17:35:31] [EMAIL PROTECTED]
I'm not satisfied with this answer :-)
Why does it work with arrays but not with strings (and, bert, yeah I
know they aren't the same).
Just because "it's strings here" doesn't legitimate that a warnings is
thrown. Using your suggestion is rather cumbersome.
Is it an implemention issue? Can it be solve to be less long winded?
"it is"
a bug imho :)
------------------------------------------------------------------------
[2002-03-03 17:28:03] [EMAIL PROTECTED]
It's not a bug, $foo{3}. "\n" is done before the @, so that displays
the error.
so I'm closing this, this works BTW:
$foo = "foo"; echo @($foo{3}. "\n");
Derick
------------------------------------------------------------------------
[2001-12-02 17:06:21] [EMAIL PROTECTED]
One more, this change happened in Zend/zend_execute.c line 103.
------------------------------------------------------------------------
[2001-12-02 17:04:40] [EMAIL PROTECTED]
Btw, this breaks BC:
[chroot] mfischer@ficken:~/isrc/cvs/php4/Zend$ php -v
4.0.6-dev
[chroot] mfischer@ficken:~/isrc/cvs/php4/Zend$ php -q
<? error_reporting(E_ALL); $foo = ''; isset($foo[2]);?>
[chroot] mfischer@ficken:~/isrc/cvs/php4/Zend$
and with RC4:
mfischer@ficken:~/isrc/cvs/php4/Zend$ php -v
4.1.0RC4
mfischer@ficken:~/isrc/cvs/php4/Zend$ php -q
<? error_reporting(E_ALL); $foo = ''; isset($foo[2]);?>
<br>
<b>Warning</b>: Uninitialized string offset: 2 in <b>-</b> on line
<b>1</b><br>
-(1) : Warning - Uninitialized string offset: 2
mfischer@ficken:~/isrc/cvs/php4/Zend$
Marking as critical.
------------------------------------------------------------------------
[2001-12-02 17:01:01] [EMAIL PROTECTED]
'isset($foo[0])' issues a warning too if $foo is an emtpy string.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/14066
--
Edit this bug report at http://bugs.php.net/?id=14066&edit=1