Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 2.2.x and PHP 8.0
#1

(This post was last modified: 12-08-2022, 12:35 AM by svenhaveman.)

Hi,
I am one of those guys that built a webapp ten years ago and updated it untill CodeIgniter 2.2.6.
Unfortunatly, CI 2 breaks when running PHP 8.0 and PHP 7.4 is reaching its end-of-life cycle. Upgrading to CI 3 and then to CI 4 takes a lot of time. Eventually will rewrite the whole thing, but for now i want to make things safe and running.
Because there are no official updates for 2.2.x and i'm running the webapp inside a isolated docker container in production i started hacking the core to get it working again, and thought i would share this with you.

Patch #1
File: system/core/Common.php
Error: $level is an optional argument, that is before a required argument. Depracated. I removed the optional flag and handled in the function itself.

Fix: replace the log_message function with the function inside the pastebin link
https://pastebin.com/1vEkkiEy

Patch #2
File: system/core/Input.php
Error: filter_var options argument needs to be an array or an integer. String given
Fix: Replace line 388, the default in the switch statement to $flag = array(); in stead of $flag = '';
https://pastebin.com/dDU1NjWX

This fixed it for me and got it working again. Maybe i did something stupid, maybe i forgot some other functions that i don't use, but you do, please share inside this topic to help other people get this up and running :-).

Thanks!
Reply
#2

Your best bet would be to upgrade it to CodeIgniter v4.2.10. Because of Security issues.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

I agree, need to update the entire thing. But at this time the application isn't publicly available and is on an isolated server. So i took other measures to keep it safe, for now :-)
Reply




Theme © iAndrew 2016 - Forum software by © MyBB