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

WordPress Trac noreply at wordpress.org
Sun Oct 16 02:56:33 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 nendeb55):

 @gziolo Thanks for the tip.
 How about sending them only when the array comes in?
 [https://github.com/WordPress/wordpress-
 develop/blob/70dedb086602287f4e0ee97fbf477adda8310963/src/wp-includes
 /class-wp-block-type.php#L340-L352]

 {{{#!php
 <?php

         public function __set( $name, $value ) {
                 if ( ! in_array( $name, $this->deprecated_properties ) ) {
                         $this->{$name} = $value;
                         return;
                 }

                 $new_name             = $name . '_handles';

                 if ( ! is_string( $value ) ) {
                         $this->{$new_name} = $value;
                 }else{
                         $this->{$new_name}[0] = $value;
                 }
         }


 }}}

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


More information about the wp-trac mailing list