pantheon-systems / solr-power

A WordPress plugin to connect to Pantheon's Apache Solr search infrastructure, or your own!
https://wordpress.org/plugins/solr-power/
GNU General Public License v2.0
126 stars 61 forks source link

Parameter 2 to SolrPower_WP_Query::the_posts() expected to be a reference, value given #341

Closed ocean90 closed 6 years ago

ocean90 commented 7 years ago

Using PHP 7.1.9 I'm seeing the PHP warning for Parameter 2 to SolrPower_WP_Query::the_posts() expected to be a reference, value given

https://github.com/pantheon-systems/solr-power/blob/ae06bbb087c938e9f670e69f1abe1f3ece4a2125/includes/class-solrpower-wp-query.php#L374-L382

The stack:

apply_filters_ref_array('the_posts')
    wp-includes/class-wp-query.php:3007
WP_Query->get_posts()
    wp-includes/class-wp-query.php:3248
WP_Query->query()
    wp-includes/class-wp.php:617
WP->query_posts()
    wp-includes/class-wp.php:735
WP->main()
    wp-includes/functions.php:955
wp()
    wp-blog-header.php:16

Since objects are always passed by reference the need for the & isn't required. Removing it removes also the warning.

zcrowe commented 6 years ago

This issue still happens when using php 7.2, let me know if there's anything else I can provide to help, but the OP covers what I'm seeing.