Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I found this debug error: PHP Deprecated: Unparenthesized a ? b : c ? d : e is deprecated. Use either (a ? b : c) ? d : e or a ? b : (c ? d : e) in /home/ptl4lmmge5kb/public_html/wp-content/plugins/give-recurring/includes/admin/class-subscriptions-list-table.php on line 143

The code from line 143 of the plugin shows this:

  ( ( 'all' === $key && empty( $current ) ) ) ? 'class="current"' : ( $current == $key ) ? 'class="current"' : '',

Can anyone tell me where to place the parenthesis?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
353 views
Welcome To Ask or Share your Answers For Others

1 Answer

Taking their first request they are asking you to use a format like this (a ? b : c) ? d : e in this

 ( ( 'all' === $key && empty( $current ) ) ) ? 'class="current"' : ( $current == $key ) ? 'class="current"' : ''

breaking it down into their terminaology in this case:

a is ( 'all' === $key && empty( $current ) ) - there was an unneeded pair of brackets here, I've removed them as we've got enough problems sorting out brackets as it is

b is 'class="current"'

c is ( $current == $key )

d is 'class="current"'

e is ''

what they are saying is that they want you to make it plain what is going to be tested for the second ? by putting the condition and result of the first in parentheses

The first is: (a ? b : c)

which becomes ( ( 'all' === $key && empty( $current ) ) ? 'class="current"' : ( $current == $key ) )

So they ask that you use:

( ( 'all' === $key && empty( $current ) ) ? 'class="current"' : ( $current == $key ) ) ? 'class="current"' : ''

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...