[wp-trac] [WordPress Trac] #47560: PHP 7.3 compact(): Undefined variable: limits in class-wp-comment-query.php on line 853

WordPress Trac noreply at wordpress.org
Wed Jun 19 03:03:10 UTC 2019


#47560: PHP 7.3 compact(): Undefined variable: limits in class-wp-comment-query.php
on line 853
--------------------------+------------------------------
 Reporter:  Andy Schmidt  |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Comments      |     Version:  4.9.8
 Severity:  major         |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+------------------------------

Comment (by Andy Schmidt):

 Obviously - short of a proper logic fix, this patch can be used in front
 of
 compact( array() )
 constructs.{{{#!php
 <?php
                 $pieces = array( 'fields', 'join', 'where', 'orderby',
 'limits', 'groupby' );
                 // patch starts:
                 foreach( $pieces as $item ) {
                         if ( isset( $$item ) )
                                 continue;        // variable already
 defined and non-null.
                         $$item = null;           // (Re)define variable in
 case missing, or already null.
                 }


 }}}

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


More information about the wp-trac mailing list