Gazzieh Posted September 4, 2021 Share Posted September 4, 2021 I have received a plugin for a system (Moodle) and, on install, get the following error in the error logs: Quote [Sat Sep 04 15:54:28.583053 2021] [php:error] [pid 15584] [client 5.153.65.228:36044] PHP 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 /var/www/html/moodle/blocks/mis_integrator/lib/url.php on line 19 The offending line of code is: $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; I haven't coded in PHP for a while now and have just updated the server to PHP 8.0 I cannot see what is wrong in this section; anyone have an idea? Quote Link to comment Share on other sites More sharing options...
Solution maxxd Posted September 4, 2021 Solution Share Posted September 4, 2021 PHP 8 requires parentheses when using nested ternary operations - https://lindevs.com/nested-ternary-operators-requires-explicit-parentheses-in-php-8-0/. Quote Link to comment Share on other sites More sharing options...
Gazzieh Posted September 4, 2021 Author Share Posted September 4, 2021 Perfect; thank you. Makes absolute sense yet I had no idea where to even begin. Again, thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.