Re: Re: [RFC] Deprecations for PHP 7.1

From: Date: Fri, 04 Mar 2016 13:53:05 +0000
Subject: Re: Re: [RFC] Deprecations for PHP 7.1
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-91500@lists.php.net to get a copy of this message
On Thu, 2016-02-18 at 19:57 +0000, Andrea Faulds wrote: > I've actually used create_function on occasion for programmatically > generating functions (in particular to create a function for each PHP > operator), but it's trivially polyfillable, and it'd be better if > people > were implementing it themselves (and thus knowing it's based on > eval()) > than using it directly without this knowledge. Just as a detail: You can't create a 100% compatible polyfill to create_function(). create_function() names functions starting with \0. Functions starting with \0 are hidden from get_defined_functions() and possibly other places. php > echo sizeof(get_defined_functions()['user']); 0 php > create_function('', ''); php > echo sizeof(get_defined_functions()['user']); 0 php > eval('function foo() {}'); php > echo sizeof(get_defined_functions()['user']); 1 johannes

Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
« previous php.internals (#91500) next »