|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-09-09 18:57 UTC] johannes@php.net
-Status: Open
+Status: Not a bug
[2013-09-09 18:57 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 24 08:00:02 2025 UTC |
Description: ------------ Methods dynamically created by assigning a closure to a property of $this cannot be called directly, but must instead by assigned to a variable first. Test script: --------------- class O { public $f; function __construct() { $this->f = function() { echo "Dynamic method\n"; }; } } $o = new O(); $f = $o->f; $f(); $o->f(); Expected result: ---------------- Dynamic method Dynamic method Actual result: -------------- Dynamic method Fatal error: Call to undefined method O::f()