[wp-trac] [WordPress Trac] #56941: Fatal error produced by block using closure as render_callback

WordPress Trac noreply at wordpress.org
Thu Apr 17 03:32:48 UTC 2025


#56941: Fatal error produced by block using closure as render_callback
--------------------------+-------------------------
 Reporter:  andrewleap    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Themes        |     Version:
 Severity:  normal        |  Resolution:  worksforme
 Keywords:                |     Focuses:
--------------------------+-------------------------

Comment (by Takahashi_Fumiki):

 This issue appears to have already been closed by the plugin author
 @andrewleap , but there are cases where other plugins consider it to be a
 WordPress issue.

 https://github.com/Yoast/wordpress-seo/issues/22181

 The above is a case where the plugin utilizes Object Cache, but since the
 WP_Taxonomy object can specify a closure in meta_cb property, it may
 eventually be serialized and cause an error depending on the environment.
 For reference, I have included a cross-reference.

 - WordPress core should not serialize arrays that may contain closure
 functions.
 - It is necessary to check in advance whether the array has a callable
 property. If it does, it should not be serialized.

 I think it might be a good idea to have a function like wp_serialize.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56941#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list