• Resolved Drivingralle

    (@drivingralle)


    Hey!

    Today I tested my website for compatibility with PHP 7.1 and got a lot of the following PHP Warnings:
    PHP Warning: Parameter 2 to Groups_Post_Access::posts_where() expected to be a reference, value given in /wp-includes/class-wp-hook.php on line 298

    If I remove the & from the second parameter on line 135 within wp-content/plugins/groups/lib/access/class-groups-post-access.php the warning doesn’t show up.

    I don’t get the warning with PHP 7.0.13

    Greetings
    derRALF

    • This topic was modified 7 years, 10 months ago by Drivingralle.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Same problem here, also with upgrade to PHP 7.1

    Thanks for posting the fix.

    I found this line in the class-groups-post.access.php file:

    public static function posts_where( $where, &$query ) {

    Changed it to:

    public static function posts_where( $where, $query ) {

    Plugin Author Kento

    (@proaktion)

    Many thanks @drivingralle and @abigailm for your feedback on this.

    The fix seems to avoid the PHP Warning but I wonder why Passing by Reference in this case (and similar ones if we check results for this search) should even be a problem now in the first place.

    Actually, I’m not entirely certain that the fix provided @drivengalle has solved the problem. In reviewing my error logs, I see that the message was only thrown off twice, on [06-Feb-2017 09:06:55 UTC] and [07-Feb-2017 09:08:50 UTC]. I made the correction about an hour after the last error.

    However, I shifted to PHP 7.1 several days earlier — so at least for me, it may be something else causing the problem. I’m going to leave things are until after 9:10am UTC on 8 Feb to test. After that I am going to revert back to the original distribution file and monitor closely.

    I might have jumped the gun because I am seeing a lot of error messages being logged from various themes and plugins with the shift to PHP 7.1 – so I was just going through error logs and reporting as I found them. But now I am questioning whether this is actually a problem.

    Thread Starter Drivingralle

    (@drivingralle)

    @abigailm and @proaktion I’m not sure if my change is a real fix. I just noticed that it’s about this line and the parameter.
    The solution is probably something more complicated. I don’t know the plugin code well enough to create a PR.

    I get this notice a lot in one of my projects.

    Greetings
    derRALF

    Thread Starter Drivingralle

    (@drivingralle)

    Hey!

    Because of a complex setup we are using the legacy mode of the groups plugin.
    Leading to even more entries in the PHP (7.1.1) log. I get about 37.000 of this notices per day.

    PHP Warning: Parameter 2 to Groups_Post_Access_Legacy::posts_where() expected to be a reference, value given in /wp-includes/class-wp-hook.php on line 298

    and still the good old notice for:
    PHP Warning: Parameter 2 to Groups_Post_Access::posts_where() expected to be a reference, value given in /wp-includes/class-wp-hook.php on line 298

    Would like to see this notice gone.

    Greetings
    derRALF

    I’m also getting the same warning when I updated to php 7.1. I removed the reference in class-groups-post-access.php as mentioned above, and the warning disappeared

    • This reply was modified 7 years, 8 months ago by lwcooper.
    Plugin Author Kento

    (@proaktion)

    Many thanks to everyone!

    This has been fixed in version 2.1.1, please feel free to comment if you see any further issues related to this topic but I’ll mark it as resolved for now.

    Cheers

    I am afraid I cannot fix it, why is that? Is it a problem with the update in general oder a certain plugin?

    angelikareitzer.at

    Warning: Parameter 2 to SyndicationDataQueries::posts_search() expected to be a reference, value given in /home/.sites/132/site1308/web/wp-includes/class-wp-hook.php on line 298

    Thanx a lot!
    Geli

    Plugin Author Kento

    (@proaktion)

    Hi Geli,

    This is not related to Groups but to another plugin – other people seem to have reported it too https://github.com/radgeek/feedwordpress/issues/86

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘PHP Warning with 7.1 – Groups_Post_Access::posts_where()’ is closed to new replies.