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 parse 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:
--------------
Parse error: parse error, unexpected T_ECHO in C:\test.php on line 5

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

Reply via email to