php7.3 compatibility: Fix compact throwing notices for multisite

In PHP 7.3, the compact() function has been changed to issue an E_NOTICE level error if a passed string refers to an unset variable. In previous versions of PHP, this notice was silently skipped. The full RFC can be viewed here: https://wiki.php.net/rfc/compact

By initializing these variables, they can be compacted.

Previously [43819].
See #44416.
Props desrosj.



git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43832 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Aaron Jorbin 2018-10-26 20:16:22 +00:00
parent 8dbb161323
commit 894e847238
2 changed files with 6 additions and 0 deletions

View File

@ -328,6 +328,7 @@ class WP_Network_Query {
$number = absint( $this->query_vars['number'] );
$offset = absint( $this->query_vars['offset'] );
$limits = '';
if ( ! empty( $number ) ) {
if ( $offset ) {
@ -393,6 +394,8 @@ class WP_Network_Query {
$where = implode( ' AND ', $this->sql_clauses['where'] );
$groupby = '';
$pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
/**

View File

@ -372,6 +372,7 @@ class WP_Site_Query {
$number = absint( $this->query_vars['number'] );
$offset = absint( $this->query_vars['offset'] );
$limits = '';
if ( ! empty( $number ) ) {
if ( $offset ) {
@ -525,6 +526,8 @@ class WP_Site_Query {
$where = implode( ' AND ', $this->sql_clauses['where'] );
$groupby = '';
$pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
/**