php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51813 Cannot declare a class property with a closure value
Submitted: 2010-05-13 20:04 UTC Modified: 2010-05-13 21:34 UTC
From: richard at rjharrison dot org Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.2 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: richard at rjharrison dot org
New email:
PHP Version: OS:

 

 [2010-05-13 20:04 UTC] richard at rjharrison dot org
Description:
------------
When declaring a class one cannot use a closure as the value of a class property. 

Test script:
---------------
http://pastie.org/958947

Expected result:
----------------
I expect closures to be allowed when defining a class's properties; it seems inconsistent that one can assign a closure to a property dynamically at run time, but not when defining a class.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-13 21:34 UTC] johannes@php.net
-Status: Open +Status: Bogus
 [2010-05-13 21:34 UTC] johannes@php.net
This was reported in other reports, and follows the current specification of the feature. There were discussions about this. This might be re-evaluated but would require a good RFC (incl. discussion of cases where methods and properties with the same name or a __call method exist) not a bug report.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 03:01:33 2024 UTC