RE: [PHP-CVS] com php-src: Do not create a fake Closure for real Closures That is solved by just returning the Closure as is, which is safe due to
Closures being immutable objects: Zend/tests/closure_061.phpt ext/reflection/php_reflection.c

From: Date: Wed, 14 Oct 2015 16:15:05 +0000
Subject: RE: [PHP-CVS] com php-src: Do not create a fake Closure for real Closures That is solved by just returning the Closure as is, which is safe due to
Closures being immutable objects: Zend/tests/closure_061.phpt ext/reflection/php_reflection.c
References: 1 2 3  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-89402@lists.php.net to get a copy of this message
> -----Original Message----- > From: Nikita Popov [mailto:nikita.ppv@gmail.com] > Sent: Wednesday, October 14, 2015 1:58 PM > To: Anatol Belski <anatol.php@belski.net> > Cc: Bob Weinand <bwoebi@php.net>; php-cvs@lists.php.net; Nikita Popov > <nikic@php.net>; Dmitry Stogov <dmitry@zend.com> > Subject: Re: [PHP-CVS] com php-src: Do not create a fake Closure for real > Closures That is solved by just returning the Closure as is, which is safe due to > Closures being immutable objects: Zend/tests/closure_061.phpt > ext/reflection/php_reflection.c > > On Wed, Oct 14, 2015 at 1:23 PM, Anatol Belski <anatol.php@belski.net> > wrote: > > > Hi Nikita, > > > > Could you pls check how this check comply with the latest patch for > > forbidding scope change of closures created by ReflectionFunctionAbstract? > > From what was discussed, when the new scope is not NULL, the new part > > of test should be failing. > > > > Turns out some code broke, because people were trying to rebind the result of > what essentially is (new ReflectionFunction($closure))->getClosure(). > This wasn't intentional: It is perfectly safe to rebind normal closures in every > possible way, even if they went through getClosure(). So this patch removes the > new restriction for the "real" closure case again. > > If you're wondering why somebody would do (new > ReflectionFunction($closure))->getClosure(), the reason seems to be that if you > have only a ReflectionFunction instance, that's the only way to get back to the > closure it was constructed from. > Thanks for the explanation. I've repackaged RC5 to include this fix, so then the closure subject is rounded up. Regards Anatol

« previous php.cvs (#89402) next »