[wp-trac] [WordPress Trac] #56271: Custom Template Parts are Duplicated, rather than being updated (PHP 5.6)

WordPress Trac noreply at wordpress.org
Tue Aug 23 14:51:11 UTC 2022


#56271: Custom Template Parts are Duplicated, rather than being updated (PHP 5.6)
-------------------------------------------------+-------------------------
 Reporter:  jonmackintosh                        |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.0.2
Component:  Editor                               |     Version:  5.8
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests has-        |     Focuses:
  screenshots has-testing-info                   |  administration
-------------------------------------------------+-------------------------
Changes (by SergeyBiryukov):

 * owner:  (none) => SergeyBiryukov
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"53927" 53927]:
 {{{
 #!CommitTicketReference repository="" revision="53927"
 Editor: Ensure `get_block_templates()` returns unique templates or
 template parts.

 The function was using the `array_column()` PHP function on an array of
 objects, which works as expected on PHP 7 or later, but not on PHP 5.6.

 This resulted in customized templates being listed multiple times on the
 Templates and Template Parts screens, and being repeatedly added between
 lists when switching between the screens.

 The issue is now resolved by replacing `array_column()` with the
 `wp_list_pluck()` WordPress core function, which provides consistent
 behavior beetween PHP versions.

 Reference: [https://github.com/php/php-src/blob/PHP-7.0.0/UPGRADING#L626
 PHP 7.0 Upgrade Notes: array_column()].

 Props uofaberdeendarren, antonvlasenko, ironprogrammer, jonmackintosh,
 costdev, hellofromTonya, swissspidy, rudlinkon.
 Fixes #56271.
 }}}

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


More information about the wp-trac mailing list