PHP 8 Fatal error Unparenthesized `a ? b : c ? d : e` is deprecated.

Created on 6 September 2023, over 1 year ago

Problem/Motivation

Fatal error: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` for line 1773 and 1774 of httprl.module.

I updated the two lines in question with the following, and it fixed the issue for me:

$location['host'] = (!empty($location['host']) ? $location['host'] : !empty($original_location['host'])) ? $original_location['host'] : $_SERVER['HTTP_HOST'];
        $location['port'] = (!empty($location['port']) ? $location['port'] : !empty($original_location['port'])) ? $original_location['port'] : '';
🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇺🇸United States jenlampton

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @jenlampton
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • First commit to issue fork.
  • 🇪🇸Spain beagaliana

    Created patch for this error for version 7.x-1.14 for HTTP Parallel Request & Threading Library module. I'll attach it here in case it might come in handy.

    It basically solves the deprecation in the same way, also adding parenthesis to solve the ambiguity. However uses the parenthesis in the latter part as I believed it made more sense for the logic of the condition.

Production build 0.71.5 2024