[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 07:01:18 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                                       |
-------------------------------------------------+-------------------------
Changes (by costdev):

 * keywords:  needs-testing has-testing-info => needs-testing has-testing-
     info dev-feedback


Comment:

 The expected results for a patch needs discussion.

 As Core did not previously protect against a non-string value, it was
 possible to register a block with `editor_script` set to an array rather
 than the documented `string|null` types.

 Pinging @gziolo as the committer of [54155]. Greg,
 [https://github.com/wordpress/wordpress-
 develop/blob/70dedb086602287f4e0ee97fbf477adda8310963/src/wp-includes
 /class-wp-block-type.php#L346 this condition] results in an array
 `editor_script` being rejected outright.

 Instead, if `editor_script` is an array, should we set
 `editor_script_handles` to the same array, and only return void for other
 non-strings?

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


More information about the wp-trac mailing list