やるきなし

2019/09/01 09:53 / WordPress on Debian 10

Debian を stretch (Debian 9) から buster (Debian 10)にあげたら apache が以下のようなWarningを吐くようになった.

[Sat Aug 31 20:XX:XX.XXXXXX 2019] [php7:warn] [pid 23XX] [client XXX.XX.XXX.XX:XXXXXX] PHP Warning:  Parameter 2 to qtranxf_postsFilter() expected to be a reference, value given in /var/www/wp-includes/class-wp-hook.php on line 286

これは qtranslate-x の問題で,https://wordpress.org/support/topic/problem-with-php-7-1-2/ によると以下のように &$query& を取り除けば良いらしい.

diff --git a/wp-content/plugins/qtranslate-x/qtranslate_frontend.php b/wp-content/plugins/qtranslate-x/qtranslate_frontend.php
index 64df38f9..461ce94e 100644
--- a/wp-content/plugins/qtranslate-x/qtranslate_frontend.php
+++ b/wp-content/plugins/qtranslate-x/qtranslate_frontend.php
@@ -520,7 +520,7 @@ function qtranxf_translate_post($post,$lang) {
        }
 }

-function qtranxf_postsFilter($posts,&$query) {//WP_Query
+function qtranxf_postsFilter($posts,$query) {//WP_Query
        global $q_config;
        //qtranxf_dbg_log('qtranxf_postsFilter: $posts: ',$posts);
        //$post->post_content = qtranxf_useCurrentLanguageIfNotFoundShowAvailable($post->post_content);
@@ -543,7 +543,7 @@ function qtranxf_postsFilter($posts,&$query) {//WP_Query
 add_filter('the_posts', 'qtranxf_postsFilter', 5, 2);

 /** allow all filters within WP_Query - many other add_filters may not be needed now? */
-function qtranxf_pre_get_posts( &$query ) {//WP_Query
+function qtranxf_pre_get_posts( $query ) {//WP_Query
        //qtranxf_dbg_log('qtranxf_pre_get_posts: $query: ',$query);
        //'post_type'
        if(isset($query->query_vars['post_type'])){