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

WordPress Trac noreply at wordpress.org
Tue Nov 1 08:58:04 UTC 2022


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

Comment (by wildworks):

 I could not reproduce it in either WordPress 6.0 or 6.1-RC6. Did it work
 correctly in WordPress 6.0?

 Here is my test procedure:

 - Run `npx @wordpress/create-block test-block` directly under the plugin
 directory
 - Update test-block.php as follows:



 {{{
 function create_block_test_block_block_init() {
         register_block_type(
                 __DIR__ . '/build',
                 array(
                         'render_callback' => function( $attributes,
 $content, $block ) {
                                 return 'rendered';
                         },
                 )
         );
 }
 add_action( 'init', 'create_block_test_block_block_init' );
 }}}



 - Insert the block into the editor and save it
 - Confirm that no errors occur in both the editor and the front end

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


More information about the wp-trac mailing list