Professional Web Applications Themes

#38766 [NEW]: Nonbreaking whitespace breaks parsing - PHP Bugs

From: a at b dot c dot de Operating system: Windows XP SP2 PHP version: 5.1.6 PHP Bug Type: Feature/Change Request Bug description: Nonbreaking whitespace breaks parsing Description: ------------ In most (Windows) fonts, character 0xa0 renders as a blank (nonbreaking) space. Some people use text editors that for whatever reason like to use 0xa0 at random locations instead of ordinary spaces. The result is code that _looks_ correct, but when run can trigger a p error for no apparent reason. In zend_language_scanner.l, 0xa0 is recognised as a LABEL character (which means, among other things, that you could have a variable ...

  1. #1

    Default #38766 [NEW]: Nonbreaking whitespace breaks parsing

    From: a at b dot c dot de
    Operating system: Windows XP SP2
    PHP version: 5.1.6
    PHP Bug Type: Feature/Change Request
    Bug description: Nonbreaking whitespace breaks parsing

    Description:
    ------------
    In most (Windows) fonts, character 0xa0 renders as a blank (nonbreaking)
    space. Some people use text editors that for whatever reason like to use
    0xa0 at random locations instead of ordinary spaces. The result is code
    that _looks_ correct, but when run can trigger a p error for no
    apparent reason.

    In zend_language_scanner.l, 0xa0 is recognised as a LABEL character (which
    means, among other things, that you could have a variable called "$ ");.
    Assuming no-one is perverted enough to do something like that, it should
    be safe to reassign it to WHITESPACE (will this cause grief in other
    character sets?).


    Reproduce code:
    ---------------
    <?php
    //There is an 0xa0 character immediately following the
    // brace on the next line
    for($i=0; $i<5; $i++){
    echo "Hello, World\n";
    }
    ?>


    Expected result:
    ----------------
    Hello, World
    Hello, World
    Hello, World
    Hello, World
    Hello, World


    Actual result:
    --------------
    P error: p error, unexpected T_ECHO in C:\test.php on line 5

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

  2. #2

    Default #38766 [Opn->WFx]: Nonbreaking whitespace breaks parsing

    ID: 38766
    Updated by: [email]derickphp.net[/email]
    Reported By: a at b dot c dot de
    -Status: Open
    +Status: Wont fix
    Bug Type: Feature/Change Request
    Operating System: Windows XP SP2
    PHP Version: 5.1.6
    New Comment:

    Can't do that as people using UTF8 in their scrips might use this
    character as part of an identifier.


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

    [2006-09-10 02:19:45] a at b dot c dot de

    Description:
    ------------
    In most (Windows) fonts, character 0xa0 renders as a blank
    (nonbreaking) space. Some people use text editors that for whatever
    reason like to use 0xa0 at random locations instead of ordinary spaces.
    The result is code that _looks_ correct, but when run can trigger a
    p error for no apparent reason.

    In zend_language_scanner.l, 0xa0 is recognised as a LABEL character
    (which means, among other things, that you could have a variable called
    "$ ");. Assuming no-one is perverted enough to do something like that,
    it should be safe to reassign it to WHITESPACE (will this cause grief
    in other character sets?).


    Reproduce code:
    ---------------
    <?php
    //There is an 0xa0 character immediately following the
    // brace on the next line
    for($i=0; $i<5; $i++){
    echo "Hello, World\n";
    }
    ?>


    Expected result:
    ----------------
    Hello, World
    Hello, World
    Hello, World
    Hello, World
    Hello, World


    Actual result:
    --------------
    P error: p error, unexpected T_ECHO in C:\test.php on line 5


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=38766&edit=1[/url]
    derick@php.net Guest

  3. #3

    Default #38766 [WFx]: Nonbreaking whitespace breaks parsing

    ID: 38766
    User updated by: a at b dot c dot de
    Reported By: a at b dot c dot de
    Status: Wont fix
    Bug Type: Feature/Change Request
    Operating System: Windows XP SP2
    PHP Version: 5.1.6
    New Comment:

    I guessed as much. Personally I blame stupid text editors for inserting
    the character on the ends of lines (which is where I've found them).


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

    [2006-09-10 09:38:04] [email]derickphp.net[/email]

    Can't do that as people using UTF8 in their scrips might use this
    character as part of an identifier.

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

    [2006-09-10 02:19:45] a at b dot c dot de

    Description:
    ------------
    In most (Windows) fonts, character 0xa0 renders as a blank
    (nonbreaking) space. Some people use text editors that for whatever
    reason like to use 0xa0 at random locations instead of ordinary spaces.
    The result is code that _looks_ correct, but when run can trigger a
    p error for no apparent reason.

    In zend_language_scanner.l, 0xa0 is recognised as a LABEL character
    (which means, among other things, that you could have a variable called
    "$ ");. Assuming no-one is perverted enough to do something like that,
    it should be safe to reassign it to WHITESPACE (will this cause grief
    in other character sets?).


    Reproduce code:
    ---------------
    <?php
    //There is an 0xa0 character immediately following the
    // brace on the next line
    for($i=0; $i<5; $i++){
    echo "Hello, World\n";
    }
    ?>


    Expected result:
    ----------------
    Hello, World
    Hello, World
    Hello, World
    Hello, World
    Hello, World


    Actual result:
    --------------
    P error: p error, unexpected T_ECHO in C:\test.php on line 5


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=38766&edit=1[/url]
    a at b dot c dot de Guest

Similar Threads

  1. CFC getter and whitespace
    By BSterner in forum Coldfusion - Advanced Techniques
    Replies: 2
    Last Post: July 16th, 12:52 AM
  2. Whitespace Problems
    By JakeFlynn in forum Macromedia ColdFusion
    Replies: 3
    Last Post: June 22nd, 09:52 PM
  3. cannot get rid of whitespace
    By AkronNick in forum Macromedia ColdFusion
    Replies: 10
    Last Post: April 11th, 06:25 PM
  4. get rid of whitespace around pipes??
    By Jeff 'Japhy' Pinyan in forum PERL Beginners
    Replies: 3
    Last Post: December 17th, 04:26 PM
  5. Trimming Whitespace
    By Sean Levesley in forum Macromedia Director Basics
    Replies: 3
    Last Post: August 22nd, 10:17 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