Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#47560 closed defect (bug) (duplicate)

PHP 7.3 compact(): Undefined variable: limits in class-wp-comment-query.php on line 853

Reported by: andy-schmidt's profile Andy Schmidt Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.8
Component: Comments Keywords: needs-patch
Focuses: Cc:


4.9.10 with PHP 7.3
compact() now requires all parameters to have existing variables.

PHP 7.3 was released in 2018, it is recommended version by WordPress -- so there should no longer be any lingering syntax notices.

Change History (4)

#1 @Andy Schmidt
5 years ago

Obviously - short of a proper logic fix, this patch can be used in front of
compact( array() )

$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.



Version 0, edited 5 years ago by Andy Schmidt (next)

#2 @swissspidy
5 years ago

  • Severity changed from major to normal

Hi @andy-schmidt, thanks for your report.

Would you be able to create a patch file with your suggested change? See for documentation about how to create patches using Git or Subversion.

#3 @earnjam
5 years ago

WordPress 5.0 was released around the same time as PHP 7.3, and was the first version with designated PHP 7.3 support.

I'm not against this per se, but I'm not sure if backporting PHP compatibility updates to older WP versions is something we typically do. I'd lean toward closing this, but I defer to those with more experience in this area.

#4 @jorbin
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #44416.

This was fixed in [43819]. 5.0 is the first version that supported PHP 7.3. WordPress 4.9 is now 3 versions behind, I would encourage you to update to the latest version.

Note: See TracTickets for help on using tickets.