php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47672 public attribute within class initial value issue
Submitted: 2009-03-16 12:14 UTC Modified: 2009-03-16 13:27 UTC
From: jimmyp2 at freemail dot gr Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.9 OS: windows 2003 std edition sp2
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: jimmyp2 at freemail dot gr
New email:
PHP Version: OS:

 

 [2009-03-16 12:14 UTC] jimmyp2 at freemail dot gr
Description:
------------
Hello,

while testing this new release i noticed that declaring a public attribute the way is shown in the "Reproduce code" section below no error/exception is issued by the scripting engine's parser. Is this a
normal  behaviour ?

Web server used : Apache v. 2.2.11
PHP version     : 5.2.9-1


Thank you.


Reproduce code:
---------------
<?php
error_reporting(E_ALL);
class TestClass
{
    public $var1 = YTRTWTRT; // notice !!! the value is not quoted 
                             // and no constant with such name exists.
}
?>


Expected result:
----------------
a parser error issued.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-16 13:27 UTC] jani@php.net
Expected, you don't get notice about it since you never use the class. The constant is checked once you do '$foo = new TestClass;'.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 12:01:33 2025 UTC