PHP 7.4: Deprecated unparantesized error
-
Since PHP 7.4 we get this error:
PHP Deprecated: Unparenthesized a ? b : c ? d : e is deprecated. Use either</code>(a ? b : c) ? d : e<code>or</code>a ? b : (c ? d : e) in /Users/yournamehere/Sites/wp-groups.test/wp-content/plugins/groups/lib/wp/class-groups-wordpress.php on line 81
and:
PHP Deprecated: Unparenthesizeda ? b : c ? d : e is deprecated. Use either(a ? b : c) ? d : e ora ? b : (c ? d : e) in /Users/yournamehere/Sites/wp-groups.test/wp-content/plugins/groups/lib/access/class-groups-access-meta-boxes.php on line 295
It is an easy fix:
Change groups/lib/access/class-groups-access-meta-boxes.php on line 295 to:
$post_id = !empty( $postarr['ID'] ) ? $postarr['ID'] : (!empty( $postarr['post_ID'] ) ? $postarr['post_ID'] : null);
And change groups/lib/wp/class-groups-wordpress.php on line 81 to:
$user_id = isset( $user->ID ) ? $user->ID : (isset( $args[1] ) ? $args[1] : 0);
There might be more occurrences throughout the plugin though.
I’ve created a new support topic because the old one is marked as [Resolved] and it is apparently no longer on the map, no replies in over a month even though it should be quite an easy fix.
- This topic was modified 4 years, 9 months ago by .
- This topic was modified 4 years, 9 months ago by .
- This topic was modified 4 years, 9 months ago by . Reason: Fixed code formatting
The page I need help with: [log in to see the link]
- The topic ‘PHP 7.4: Deprecated unparantesized error’ is closed to new replies.