Error: PHP Deprecated Unparenthesized ternary operator
-
No help needed here, just a bugfix I wanted to report which is filling up my error reporting.
Error logging shows two errors:
PHP Deprecated: Unparenthesized 'a ? b : c ? d : e' is deprecated. Use either '(a ? b : c) ? d : e' or 'a ? b : (c ? d : e)' in ~/wp-content/plugins/groups/lib/wp/class-groups-wordpress.php on line 81 PHP Deprecated: Unparenthesized 'a ? b : c ? d : e' is deprecated. Use either '(a ? b : c) ? d : e' or 'a ? b : (c ? d : e)' in ~/wp-content/plugins/groups/lib/access/class-groups-access-meta-boxes.php on line 301.
This is easily fixed with wrapping the first part of the ternary operator in parentheses.
On file class-groups-wordpress.php on line 81:
$user_id = (isset( $user->ID ) ? $user->ID : isset( $args[1] )) ? $args[1] : 0;
On file class-groups-access-meta-boxes.php on line 301:
$post_id = (!empty( $postarr['ID'] ) ? $postarr['ID'] : !empty( $postarr['post_ID'] )) ? $postarr['post_ID'] : null;
Cheers!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Error: PHP Deprecated Unparenthesized ternary operator’ is closed to new replies.