[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:55:13 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
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 In [changeset:"53928" 53928]:
 {{{
 #!CommitTicketReference repository="" revision="53928"
 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.
 Merges [53927] to the 6.0 branch.
 Fixes #56271.
 }}}

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


More information about the wp-trac mailing list