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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 13:01:33 2025 UTC