#27059 [NEW]: Variable with empty name can be made
| From: | uno at venus dot dti dot ne dot jp | Date: | Tue, 27 Jan 2004 15:17:09 +0000 |
| Subject: | #27059 [NEW]: Variable with empty name can be made | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-53962@lists.php.net to get a copy of this message | ||
From: uno at venus dot dti dot ne dot jp
Operating system: any
PHP version: 4.3.4
PHP Bug Type: Class/Object related
Bug description: Variable with empty name can be made
Description:
------------
Variable or object property can be made with empty name.
This behaviour doesn't match the manual.
http://www.php.net/manual/en/language.variables.php
Variable names follow the same rules as other labels in PHP.
A valid variable name starts with a letter or underscore,
followed by any number of letters, numbers, or underscores.
As a regular expression, it would be expressed thus:
'[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
http://www.php.net/manual/en/language.oop.php
A class is a collection of variables and functions working
with these variables.
Reproduce code:
---------------
<?php
error_reporting(E_ALL);
${''} = 'abc';
echo ${''};
class X{
}
$x = new X;
$x->{''} = 'def';
echo $x->{''};
?>
Expected result:
----------------
Error. (warning or notice are acceptable for me)
Actual result:
--------------
abcdef
--
Edit bug report at http://bugs.php.net/?id=27059&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27059&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27059&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27059&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27059&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27059&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27059&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27059&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27059&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27059&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27059&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27059&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27059&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27059&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27059&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27059&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27059&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27059&r=float