[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 03:05: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):

 Maybe is_array is better than is_string for judging.

  {{{#!php
  <?php

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

                  $new_name             = $name . '_handles';

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

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


More information about the wp-trac mailing list