php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26662 Inconsistency in variable setting allows variables that start with numbers
Submitted: 2003-12-18 21:06 UTC Modified: 2005-09-02 08:47 UTC
From: alindeman@php.net Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: PHP 5.0.1 (cli) 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: alindeman@php.net
New email:
PHP Version: OS:

 

 [2003-12-18 21:06 UTC] alindeman@php.net
Description:
------------
It is possible to set variables that start with numbers.

I reproduced this with a PHP 4.3.x-dev snapshot AND PHP 5.0.0b2 (I was unable to get a snap to compile.  autoconf errors out the wazoo).

Reproduce code:
---------------
andrew@laptop cli $ ./php -r '${1} = "foo"; echo ${1}, "\n";'
foo

Expected result:
----------------
A parse error

Actual result:
--------------
Outputs 'foo'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-18 21:25 UTC] john@php.net
Confirmed this bug is in PHP 5 B3RC1 as well. It gets worse, you can put whatever you want in ${} and it'll take it just fine...
 [2003-12-18 21:42 UTC] iliaa@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Dupe of bug #26601 which is marked won't fix.
 [2003-12-19 07:54 UTC] sniper@php.net
Then you should set the version correctly, and category..

 [2004-08-31 18:02 UTC] betz@php.net
Updated version, changed category.
php -r '${1} = "foo"; echo ${1}, "\n";'
still outputs foo.
 [2005-09-02 08:47 UTC] sniper@php.net
Still wrong version and category and can't reproduce -> bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:28 2024 UTC