Welcome Guest, Not a member yet? Register   Sign In
CI 3.1.11, PHP 7.4, url_helper Critical Error

(This post was last modified: 12-05-2020, 12:22 PM by JustBoo. Edit Reason: Formatting )

Hello. I've been running CI 3.0.6 with PHP 5.6 and 7.2 for years with no problems.

I had to upgrade my PHP version to 7.4 due to my ISP. The site now has the error below:

Message:  Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`

Filename: helpers/url_helper.php

Line Number: 162

I cannot upgrade to CI 4.x at this time. So I upgraded to 3.1.11.

The offending code is:

PHP Code:
$site_url is_array($uri)
: (
preg_match('#^(\w+:)?//#i'$uri) ? $uri site_url($uri)); 

Since I don't get a valid url everything is messed up. (No CSS, etc.)

Frankly I don't use PHP enough to know how to convert the is_array() to make use of the parens that PHP 7.4 now wants. Searching came up dry for me.

Any help would be deeply appreciated.  Thank you.


Any reason why you didn't upgrade your CI version from 3.0.6 to 3.1.11?


Have you taken the problem code and restructured it to see if you can get a better consistent and correct answer? Have you at least tried to see where at in the problem code the error is happening?

Did you try the CodeIgniter Developer version from GitHub?

CodeIgniter 3.2 Developer Version
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Theme © iAndrew 2016 - Forum software by © MyBB