|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-01-14 11:39 UTC] nikic@php.net
-Type: Bug
+Type: Documentation Problem
[2017-01-14 11:39 UTC] nikic@php.net
[2017-01-14 13:39 UTC] cmb@php.net
-Status: Open
+Status: Verified
[2017-01-14 18:38 UTC] php at sunyanzi dot me
[2017-01-14 18:48 UTC] php at sunyanzi dot me
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 13:00:01 2025 UTC |
Description: ------------ Just see code ... $cl_foo is running correctly but $cl_bar not ... It seems that there's two types of Closure ... same name ... different behavior ... Actually I am not sure this is a bug or not ... get no clue reading the document ... Test script: --------------- <?php $foo = new class { private $in = 'this is foo'; public function func() { echo $this->cc; } }; $bar = new class { private $in = 'this is bar'; }; $cl_foo = Closure::fromCallable([ $foo, 'func' ]); $cl_bar = Closure::bind( $cl_foo, $bar ); Expected result: ---------------- this is bar // or "this is foo" ? Actual result: -------------- Cannot bind method class@anonymous::func() to object of class class@anonymous