Ask a Question related to PHP Bugs, Design and Development.
-
mpb dot mail at gmail dot com #1
#39018 [NEW]: Error control operator '@' fails to suppress "Uninitialized string offset"
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 [url]http://bugs.php.net/?id=39018&edit=1[/url]
--
Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=39018&r=trysnapshot44[/url]
Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=39018&r=trysnapshot52[/url]
Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=39018&r=trysnapshot60[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=39018&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=39018&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=39018&r=needtrace[/url]
Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=39018&r=needscript[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=39018&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=39018&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=39018&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=39018&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=39018&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=39018&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=39018&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=39018&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=39018&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=39018&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=39018&r=float[/url]
No Zend Extensions: [url]http://bugs.php.net/fix.php?id=39018&r=nozend[/url]
MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=39018&r=mysqlcfg[/url]
mpb dot mail at gmail dot com Guest
-
#37773 [Asn->Csd]: iconv_substr() gives "Unknown error" when string length = 1"
ID: 37773 Updated by: iliaa@php.net Reported By: dave at dgx dot cz -Status: Assigned +Status: Closed Bug Type: ICONV... -
#37773 [Ver->Asn]: iconv_substr() gives "Unknown error" when string length = 1"
ID: 37773 Updated by: tony2001@php.net Reported By: dave at dgx dot cz -Status: Verified +Status: Assigned Bug Type: ... -
"Error Creating Control" and "Cast from String"
I'm creating a custom date control. In appearance, it's just a textbox and a button. It has three custom properties: CalDate, CalDateType and... -
#14066 [Com]: Can't suppress warnigns on accessing invalid string offset
ID: 14066 Comment by: php at pleaseletusknow dot com Reported By: mfischer at guru dot josefine dot at Status: ... -
#26292 [Opn->Bgs]: substr returns "0" for any offset on the string "0"
ID: 26292 Updated by: sniper@php.net Reported By: ravacholp at hotmail dot com -Status: Open +Status: ... -
iliaa@php.net #2
#39018 [Opn->Bgs]: Error control operator '@' fails to suppress "Uninitialized string offset"
ID: 39018
Updated by: [email]iliaa@php.net[/email]
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
[url]http://www.php.net/manual/[/url] and the instructions on how to report
a bug at [url]http://bugs.php.net/how-to-report.php[/url]
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 [url]http://bugs.php.net/?id=39018&edit=1[/url]
iliaa@php.net Guest
-
mpb dot mail at gmail dot com #3
#39018 [Bgs->Opn]: Error control operator '@' fails to suppress "Uninitialized string offset"
ID: 39018
User updated by: mpb dot mail at gmail dot com
Reported By: mpb dot mail at gmail dot com
-Status: Bogus
+Status: Open
Bug Type: Scripting Engine problem
Operating System: Gentoo Linux
PHP Version: 5.1.6
New Comment:
While operator precedence explains the notice generated by line 7 of my
original example, it does not explain the other lines.
Here is a simpler example clearly showing this bug has nothing to do
with operator precedence. The notices in line 11 and 14 should be
suppressed - but they are not. Compare lines 11 and 14 to lines 12 and
15 respectively.
Reproduce code:
---------------
<?php
error_reporting (E_ALL | E_NOTICE);
$s = 'test';
$a = array ('t', 'e', 's', 't');
if ( $s[4] ); // line 8, not suppressed
if ( $a[4] ); // line 9, not suppressed
if ( @ $s[4] ); // line 11, not suppressed
if ( @ $a[4] ); // line 12, suppressed
if ( @ ( $s[4] ) ); // line 14, not suppressed
if ( @ ( $a[4] ) ); // line 15, suppressed
if ( @ ( $x=$s[4] ) ); // line 17, suppressed
if ( @ ( $y=$a[4] ) ); // line 18, suppressed
print "Done!\n";
?>
Expected result:
----------------
Notice: Uninitialized string offset: 4 in /borg/ripple/parke/test4.php
on line 8
Notice: Undefined offset: 4 in /borg/ripple/parke/test4.php on line 9
Done!
Actual result:
--------------
Notice: Uninitialized string offset: 4 in /borg/ripple/parke/test4.php
on line 8
Notice: Undefined offset: 4 in /borg/ripple/parke/test4.php on line 9
Notice: Uninitialized string offset: 4 in /borg/ripple/parke/test4.php
on line 11
Notice: Uninitialized string offset: 4 in /borg/ripple/parke/test4.php
on line 14
Done!
Previous Comments:
------------------------------------------------------------------------
[2006-10-03 19:57:35] [email]iliaa@php.net[/email]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
[url]http://www.php.net/manual/[/url] and the instructions on how to report
a bug at [url]http://bugs.php.net/how-to-report.php[/url]
Operator precedence is working against you in this instance.
The operation involving offset operation is before before the
error blocking operator is considered.
------------------------------------------------------------------------
[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 [url]http://bugs.php.net/?id=39018&edit=1[/url]
mpb dot mail at gmail dot com Guest



Reply With Quote

