|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-12-03 04:58 UTC] oorza2k5 at gmail dot com
[2010-12-20 13:20 UTC] jani@php.net
-Package: Feature/Change Request
+Package: Scripting Engine problem
[2015-08-31 17:06 UTC] cmb@php.net
-Type: Feature/Change Request
+Type: Documentation Problem
-Assigned To:
+Assigned To: cmb
[2015-08-31 17:06 UTC] cmb@php.net
[2015-09-06 15:06 UTC] cmb@php.net
[2015-09-06 15:06 UTC] cmb@php.net
-Status: Assigned
+Status: Closed
[2015-09-06 15:06 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 19:00:01 2025 UTC |
Description: ------------ When you store a closure as a class property, while having a method with the same name, it's unclear (I don't think this is documented anywhere) what $obj->name($arg) will do. If this is the case, a warning about code ambiguity ought to be raised. This is a potentially very confusing scenario, perhaps an E_STRICT error ought to be raised whenever two class members share the same name, regardless of whether a property contains a closure or not. Reproduce code: --------------- class foo { public $bar; public function bar() { echo "Inside a method!"; } } $obj = new foo(); $obj->bar = function() { echo "Inside a closure!"; }; $obj->bar(); Expected result: ---------------- Notice: .... Inside a method! Actual result: -------------- Inside a method!