php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52279 non-breaking space not threated as white space
Submitted: 2010-07-07 18:29 UTC Modified: 2010-07-08 04:55 UTC
From: nefthy-php dot net at nefthy dot de Assigned:
Status: Not a bug Package: *Compile Issues
PHP Version: 5.3.2 OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
47 - 5 = ?
Subscribe to this entry?

 
 [2010-07-07 18:29 UTC] nefthy-php dot net at nefthy dot de
Description:
------------
The unicode character 00A0 (non breaking space) is not threated as whitespace.

Test script:
---------------
$a_="foo"; 
echo $a;

substitute _ above with non-breaking space. Under X11 usualy windowkey followed bei two spaces. The non breaking space actualy bekomes part of the variable name.

Expected result:
----------------
foo

Actual result:
--------------
Notice: Undefined variable $a ..

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-08 04:55 UTC] aharvey@php.net
-Status: Open +Status: Bogus
 [2010-07-08 04:55 UTC] aharvey@php.net
This is expected behaviour. To quote 
http://au2.php.net/manual/en/language.variables.basics.php:

Note: For our purposes here, a letter is a-z, A-Z, and the bytes from 127 
through 255 (0x7f-0xff).

Exactly what happens in your example will depend on the encoding of the script, 
but if it's UTF-8, then the non-breaking space is represented as two bytes (C2; 
A0), both of which are above 7F and therefore are valid within a variable name.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 10:01:28 2024 UTC