ID:               14066
 Updated by:       [EMAIL PROTECTED]
-Summary:          Can't suppress warnigns on accessing invalid string
                   offset
 Reported By:      [EMAIL PROTECTED]
-Status:           Critical
+Status:           Closed
 Bug Type:         Scripting Engine problem
 Operating System: Any
 PHP Version:      4.0CVS-2001-11-15
 Assigned To:      derick
 New Comment:

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


Previous Comments:
------------------------------------------------------------------------

[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.

------------------------------------------------------------------------

[2001-11-15 02:33:34] [EMAIL PROTECTED]

When setting error_reporting(E_ALL) the following occurs:

<?
error_reporting(E_ALL);

$foo = array(); echo $foo[0] . "\n"; // <-- warning
$foo = array(); echo @$foo[0]. "\n"; // <-- no warning

$foo = "foo"; echo $foo{3} . "\n"; // <-- warning
$foo = "foo"; echo @$foo{3}. "\n"; // <-- still warning
?>

The last line should not emit a warning.

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=14066&edit=1

Reply via email to