php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1950 "$" not accepted in a class variable affectation
Submitted: 1999-08-03 12:41 UTC Modified: 1999-08-03 14:51 UTC
From: christophe dot massiot at mail dot dotcom dot fr Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Latest CVS (03/08/1999) OS: Debian GNU/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: christophe dot massiot at mail dot dotcom dot fr
New email:
PHP Version: OS:

 

 [1999-08-03 12:41 UTC] christophe dot massiot at mail dot dotcom dot fr
The following script produces a parse error in PHP 4b2 :

class foo {
  var $bar = "foobar$";
}

I fully understand that the problem comes from the $ sign, and escaping it with a \
solves the problem, but this syntax worked with PHP 3, and simply doing
 $bar = "foobar$"; in the global scope works too.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-08-03 14:51 UTC] andi at cvs dot php dot net
This is a documented incompatibility with PHP 3.0.
You can't initialize class members with non-scalar expressions. This is because of the architecture of PHP 4.0 which is a step closer to compiling then PHP 3.0.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC