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...
Abdh Posted August 23, 2023 Share Posted August 23, 2023 Upgrade virsion 7 to 8.2 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in C:\xampp\phpMyAdmin\vendor\phpmyadmin\motranslator\src\Loader.php on line 116 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in C:\xampp\phpMyAdmin\vendor\phpmyadmin\motranslator\src\Loader.php on line 118 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in C:\xampp\phpMyAdmin\vendor\phpmyadmin\motranslator\src\Loader.php on line 120 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in C:\xampp\phpMyAdmin\vendor\phpmyadmin\motranslator\src\Loader.php on line 126 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in C:\xampp\phpMyAdmin\vendor\phpmyadmin\motranslator\src\Loader.php on line 128 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in C:\xampp\phpMyAdmin\vendor\phpmyadmin\motranslator\src\Loader.php on line 130 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 C:\xampp\phpMyAdmin\libraries\DatabaseInterface.php on line 518 Thank you Quote Link to comment Share on other sites More sharing options...
Barand Posted August 23, 2023 Share Posted August 23, 2023 So... Fix the errors. The messages tell you what's wrong and what they should be. Don't hijack other peoples threads. Quote Link to comment Share on other sites More sharing options...
maxxd Posted August 23, 2023 Share Posted August 23, 2023 Especially threads that are almost two years old... 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.