note 121978 added to reflectionfunction.invokeargs

From: Date: Tue, 05 Dec 2017 13:40:32 +0000
Subject: note 121978 added to reflectionfunction.invokeargs
Groups: php.notes 
Request: Send a blank email to php-notes+get-209313@lists.php.net to get a copy of this message
In the case of call_user_func_array(), if you were to pass around an anonymous function and reference $this within the anonymous function, $this will faithfully refer to the class in the context in which the function was defined. Using ReflectionFunction::invokeArgs() does not seem to retain its original context--yeah, even if you bind the anonymous function before invoking. I recommend call_user_func_array() where context is a concern. ---- Server IP: 208.43.231.9 Probable Submitter: 50.79.92.173 ---- Manual Page -- http://php.net/manual/en/reflectionfunction.invokeargs.php Edit -- https://master.php.net/note/edit/121978 Del: integrated -- https://master.php.net/note/delete/121978/integrated Del: useless -- https://master.php.net/note/delete/121978/useless Del: bad code -- https://master.php.net/note/delete/121978/bad+code Del: spam -- https://master.php.net/note/delete/121978/spam Del: non-english -- https://master.php.net/note/delete/121978/non-english Del: in docs -- https://master.php.net/note/delete/121978/in+docs Del: other reasons-- https://master.php.net/note/delete/121978 Reject -- https://master.php.net/note/reject/121978 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#209313) next »