|  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
 [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.


Add a Patch

Pull Requests

Add a Pull Request


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-2021 The PHP Group
All rights reserved.
Last updated: Sat Jun 12 15:01:23 2021 UTC