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
signature.asc
Description: This is a digitally signed message part
