From:             mpb dot mail at gmail dot com
Operating system: Gentoo Linux
PHP version:      5.1.6
PHP Bug Type:     Scripting Engine problem
Bug description:  Error control operator '@' fails to suppress "Uninitialized 
string offset"

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 bug report at http://bugs.php.net/?id=39018&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=39018&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=39018&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=39018&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=39018&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=39018&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=39018&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=39018&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=39018&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=39018&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=39018&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=39018&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=39018&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=39018&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39018&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=39018&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=39018&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=39018&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39018&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=39018&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=39018&r=mysqlcfg

Reply via email to