ID: 49515
Comment by: oorza2k5 at gmail dot com
Reported By: oorza2k5 at gmail dot com
Status: Open
Bug Type: Feature/Change Request
Operating System: Irrelevant
PHP Version: 5.3.0
New Comment:
Any chance this gets looked at?
Previous Comments:
------------------------------------------------------------------------
[2009-09-09 20:56:41] oorza2k5 at gmail dot com
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!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49515&edit=1