[wp-trac] [WordPress Trac] #56707: `register_block_type`'s `editor_script` handle fails if it is an array.

WordPress Trac noreply at wordpress.org
Thu Oct 13 11:19:21 UTC 2022


#56707: `register_block_type`'s `editor_script` handle fails if it is an array.
-------------------------------------------------+-------------------------
 Reporter:  nendeb55                             |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  6.1
Component:  Editor                               |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  needs-testing has-testing-info dev-  |     Focuses:
  feedback                                       |
-------------------------------------------------+-------------------------

Comment (by gziolo):

 > Instead, if editor_script is an array, should we set
 editor_script_handles to the same array? Should this happen for all the
 deprecated properties, or should these just return void?

 I'm curious how it worked correctly in the first place, but let's address
 it gracefully.

 @costdev, I believe what you suggested makes perfect sense, and we can
 apply it to all script types to make the patch simple. I guess all we need
 to change is this lines:

 https://github.com/WordPress/wordpress-
 develop/blob/70dedb086602287f4e0ee97fbf477adda8310963/src/wp-includes
 /class-wp-block-type.php#L346-L351

 When an array is passed, it would be as simple as:

 {{{#!php
 $this->{$new_name} = $value;
 }}}

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


More information about the wp-trac mailing list