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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
31 - 21 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 06:01:35 2024 UTC