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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nefthy-php dot net at nefthy dot de
New email:
PHP Version: OS:

 

 [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-2020 The PHP Group
All rights reserved.
Last updated: Sat Apr 04 09:01:23 2020 UTC