|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24388 Redefining class properties
Submitted: 2003-06-29 12:52 UTC Modified: 2003-06-29 13:32 UTC
From: xbite at exonium dot net Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 4.3.2 OS: Linux - Slackware 8.0
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:
Solve the problem:
44 - 26 = ?
Subscribe to this entry?

 [2003-06-29 12:52 UTC] xbite at exonium dot net
If you redefine class property, you don't get any errors.

Reproduce code:
class Class {
  var $property = "some value";
  var $property = "some other value";

Expected result:
PHP should generate an error.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-29 13:00 UTC]
It does:
[derick@kossu derick]$ php-4.3.3RC1 
class Class {
  var $property = "some value";
  var $property = "some other value";
PHP Parse error:  parse error, expecting `T_STRING' in - on line 2

 [2003-06-29 13:08 UTC] xbite at exonium dot net
sorry for bad code -- not "class Class", try something else insted of "Class".
 [2003-06-29 13:32 UTC]
[derick@kossu derick]$ php
class F {
  var $property = "some value";
  var $property = "some other value";
PHP Fatal error:  Cannot redeclare f::$property in - on line 4

As you see this works fine (with PHP-5.0.0dev).
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 13 17:01:30 2024 UTC