Skip to content

Sermon feed broken due to nested ternary operatory ? #299

@tstephen

Description

@tstephen

Expected Behaviour

RSS sermon feed to be successfully served and valid.

Actual Behaviour

When I visit the feed url it returns:

<error>
<code>internal_server_error</code>
<title>WordPress &amp;rsaquo; Error</title>
<message>
&lt;p&gt;There has been a critical error on this website.&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://wordpress.org/support/article/faq-troubleshooting/&quot;&gt;Learn more about troubleshooting WordPress.&lt;/a&gt;&lt;/p&gt;
</message>
<data>
<status>500</status>
</data>
</error>

Simultaneously this error appears in the log:

Fatal error: Unparenthesized `a ? b : c ? d : e` is not supported. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in /wp-content/plugins/sermon-manager-for-wordpress/views/wpfc-podcast-feed.php on line 165

As you can see in the latest code that line does not have the expected parentheses.
Judging by this WordPress support request this is a new feature of PHP 7.4. We are currently running:

PHP 8.0.24 (cli) (built: Sep 29 2022 14:56:00) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.24, Copyright (c) Zend Technologies

Steps To Reproduce

  1. Run sermon manager under PHP 8
  2. Visit sermon feed
  3. Boom!

Platform

Sermon Manager Version: 2.16.9
WordPress Version: 6.0.2
PHP Version: 8.0.24

Any Additional Info

PR to follow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions