Support » Plugin: qTranslate X » Problem with PHP 7.1

  • When PHP 7.1 is enabled I get this message on my site:

    Warning: Parameter 2 to qtranxf_postsFilter() expected to be a reference, value given in /var/www/DOMAIN/htdocs/wordpress/wp-includes/class-wp-hook.php on line 298

    If I use PHP 7.0 problem does not appear.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hello, I had the same problem. For your needs just remove character ‘&’ before $query parameters in functions:

    qtranslate_frontend.php:qtranxf_excludeUntranslatedPosts()
    qtranslate_frontend.php:qtranxf_postsFilter()

    Tested on qTranslate X plugin version 3.4.6.8

    in which file do I need to remove the & character?

    Hi

    You will find it in qtranslate-x/qtranslate_frontend.php

    In line 523 change

    function qtranxf_postsFilter($posts,&$query) {//WP_Query

    to

    function qtranxf_postsFilter($posts,$query) {//WP_Query

    and in line 597 change

    function qtranxf_excludeUntranslatedPosts($where,&$query) {//WP_Query

    to

    function qtranxf_excludeUntranslatedPosts($where,$query) {//WP_Query

    Cheers

    Marco

    • This reply was modified 11 months, 2 weeks ago by  webrockers.

    Thanks a lot @webrockers, worked perfectly for me.

    thank so much @webrockers , it also worked for me after moving my site from a PHP 5 hosting to a PHP 7.1

    I´ve just made a registration on WP to thank you.

    It is nice to learn that some of my output is of help.

    So thanks for telling me!

    Aloha and Mahalo

    Marco

    I have today this problem too when transfer page to other webhosting… All 37 plugins work perfectly, but this qTranslate… OMG… Why can´t repair this problem with update???

    (and thanx the guy for solve “&”)

    • This reply was modified 9 months, 1 week ago by  18TommyBoy.

    thank you very much

    Same here. Waiting for update …

    I’ve got this warning today on XAMPP local server with PHP Version 7.1.7.

    The @schmatej answer resolved the problem.

    remove character ‘&’ before $query parameters in functions:

    qtranslate_frontend.php:qtranxf_excludeUntranslatedPosts()
    qtranslate_frontend.php:qtranxf_postsFilter()

    .
    Warning : class-wp-hook.php on line 298
    .
    plugins
    All Meta Tags
    By Arthur Gareginyan
    .
    Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in /home/www/web411/html/bjoern/wp/wp-includes/class-wp-hook.php on line 298
    .
    plugins
    All Meta Tags
    By Arthur Gareginyan
    .
    Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in /home/www/web411/html/bjoern/wp/wp-includes/class-wp-hook.php on line 298
    .
    All Meta Tags, class-wp-hook
    .

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Problem with PHP 7.1’ is closed to new replies.