#39018 [Opn->Bgs]: Error control operator '@' fails to suppress "Uninitialized string offset"
| From: | iliaa@php.net | Date: | Tue, 03 Oct 2006 19:57:35 +0000 |
| Subject: | #39018 [Opn->Bgs]: Error control operator '@' fails to suppress "Uninitialized string offset" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-103053@lists.php.net to get a copy of this message | ||
ID: 39018
Updated by: iliaa@php.net
Reported By: mpb dot mail at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Gentoo Linux
PHP Version: 5.1.6
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Operator precedence is working against you in this instance.
The operation involving offset operation is before before the
error blocking operator is considered.
Previous Comments:
------------------------------------------------------------------------
[2006-10-02 19:28:34] mpb dot mail at gmail dot com
Description:
------------
The error control operator '@' fails to suppress (some) "Uninitialized
string offset" notices.
See example for details.
The problem also occurs on with PHP 4.4.x.
Reproduce code:
---------------
<?php
error_reporting (E_ALL | E_NOTICE);
$x = 'test';
$x[4]; // No notice at all - compiler optimization??
@$y = $x[4]; // Notice supressed.
@'a' == $x[4]; // Notice NOT supressed - but it should be.
@$x[4] == 'a'; // Notice NOT supressed - but it should be.
(@$x[4]) == 'a'; // Notice NOT supressed - but it should be.
(@($x[4])) == 'a'; // Notice NOT supressed - but it should be.
@($x[4]) == 'a'; // Notice NOT supressed - but it should be.
@($x[4] == 'a'); // Notice supressed.
print "Done!\n";
?>
Expected result:
----------------
Done!
Actual result:
--------------
Notice: Uninitialized string offset: 4 in /home/build/test.php on line
7
Notice: Uninitialized string offset: 4 in /home/build/test.php on line
8
Notice: Uninitialized string offset: 4 in /home/build/test.php on line
9
Notice: Uninitialized string offset: 4 in /home/build/test.php on line
10
Notice: Uninitialized string offset: 4 in /home/build/test.php on line
11
Done!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39018&edit=1