[wp-trac] [WordPress Trac] #31496: register_uninstall_hook tries to serialize anonymous functions

WordPress Trac noreply at wordpress.org
Sun Mar 1 04:56:30 UTC 2015


#31496: register_uninstall_hook tries to serialize anonymous functions
--------------------------------+-----------------------------
 Reporter:  giuseppe.mazzapica  |      Owner:
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Plugins             |    Version:
 Severity:  normal              |   Keywords:
  Focuses:                      |
--------------------------------+-----------------------------
 `register_uninstall_hook` saves uninstall callback in database.

 If one passes a closure as uninstall callback WordPress tries to serialize
 it, causing a ''Serialization of Closure'' Exception.

 `register_uninstall_hook` already ensures that array callbacks are not
 allowed if first element of the array is an object (see #13786).

 The complete check should be something like:

 {{{
 if ( is_object( $callback ) || ( is_array( $callback ) && is_object(
 $callback[0] ) ) ) {
 }}}

 Checking for `is_object` also prevents usage of invokable objects.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31496>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list