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
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: 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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 08:01:29 2025 UTC