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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 09:01:34 2025 UTC