[wp-trac] [WordPress Trac] #44416: `compact()` will throw notice for undefined variables in PHP 7.3

WordPress Trac noreply at wordpress.org
Wed Oct 24 17:18:05 UTC 2018


#44416: `compact()` will throw notice for undefined variables in PHP 7.3
-------------------------------------------------+-------------------------
 Reporter:  desrosj                              |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  5.0
Component:  General                              |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing php73        |     Focuses:
  fixed-5.0                                      |
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 I'd still like to consider [attachment:"44416-wp_insert_post-rework.diff"]
 for 5.1.

 This seems a bit too clever to grasp at a glance, and should be simplified
 per the [https://make.wordpress.org/core/handbook/best-practices/coding-
 standards/php/#clever-code coding standards]:
 {{{
 $new_postarr = array_merge(
         array(
                 'ID' => $post_ID,
         ),
         compact( array_diff( array_keys( $defaults ), array( 'context',
 'filter' ) ) )
 );
 }}}

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


More information about the wp-trac mailing list