[wp-trac] [WordPress Trac] #10493: Allow closures as callbacks

WordPress Trac wp-trac at lists.automattic.com
Fri Dec 25 05:51:29 UTC 2009


#10493: Allow closures as callbacks
-------------------------+--------------------------------------------------
 Reporter:  scribu       |       Owner:  scribu   
     Type:  enhancement  |      Status:  new      
 Priority:  normal       |   Milestone:  3.0      
Component:  General      |     Version:  2.9      
 Severity:  normal       |    Keywords:  has-patch
-------------------------+--------------------------------------------------

Comment(by dd32):

 > I'm not sure we need to do this.

 Me too. We dont -need- to do this, But might as well support new PHP
 syntax.

 >> We shouldn't be encouraging create_function in this case anyway as
 there are possible security risk.
 > Precisely: You can't create closures in the same way you can pass a
 string to create_function(), so it's actually encouraging safer code.

 I quite agree, its virtually moving it to a lamba function and passing
 that as the action hook.. exactly the same as create_function, Just
 without all the PHP code in a string.. which can be insecure if done
 wrong.

 Only down side to this, is that some plugins may use it and those without
 the latest PHP will not be able to use it. But thats a call on the authors
 behalf, if they choose to use PHP 5.whatever syntax, then they're the ones
 removing the ability for others to use their plugins.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10493#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list