Professional Web Applications Themes

#39018 [NEW]: Error control operator '' fails to suppress "Uninitialized string offset" - PHP Bugs

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] == ...

  1. #1

    Default #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

  2. #2

    Default #39018 [Opn->Bgs]: Error control operator '' fails to suppress "Uninitialized string offset"

    ID: 39018
    Updated by: [email]iliaaphp.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 doentation 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

  3. #3

    Default #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]iliaaphp.net[/email]

    Thank you for taking the time to write to us, but this is not
    a bug. Please double-check the doentation 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

Similar Threads

  1. Replies: 0
    Last Post: November 15th, 06:35 PM
  2. Replies: 0
    Last Post: October 18th, 09:19 PM
  3. "Error Creating Control" and "Cast from String"
    By Lisa in forum ASP.NET Building Controls
    Replies: 1
    Last Post: August 14th, 01:53 PM
  4. #14066 [Com]: Can't suppress warnigns on accessing invalid string offset
    By php at pleaseletusknow dot com in forum PHP Development
    Replies: 0
    Last Post: November 18th, 02:49 PM
  5. Replies: 0
    Last Post: November 17th, 10:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139