-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for PHP 8.3 #6278
Comments
Codeigniter 3.1.13 don't support PHP >8.2 (yet), you can however update on your own using these changes If you instead would like an updated repo with PHP 8.2 support see; |
I am extending a copy of CodeIgniter 3 that works with PHP 8.3 from here: https://github.com/sylynder/webby, https://github.com/sylynder/engine. I am also borrowing some concepts from CodeIgniter 4 |
@jafjaf, I would like to ask: with the current CodeIgniter v3.1.13, what is the latest stable PHP version that works out-of-the-box? |
currently i have 2 projects using the Codeigniter version 3.1.13 running with php 8.2. |
A fresh install of Codeigniter 3 supports PHP version up to and including 8.1. I'm also running multiple projects using PHP 8.3 and Codeigniter 3 (with PHP >8.2) changes implemented. |
I didn't expect to get a response this fast. Wow, the community is still great 🥳 @mariolucasdev Do you run CodeIgniter v3.1.13 with PHP 8.2 without making any changes to the system? @jafjaf So, it is safe to use PHP 8.1? And if I want to upgrade to PHP 8.2 or higher, then I need to make the changes you mentioned? I am still working on a CodeIgniter 3 project, so I need to know which is the latest PHP version that is safe to upgrade to. |
It depends on how you define "safe."
However, the community remains quite active, and there are ongoing efforts to keep CodeIgniter 3 viable with updates and patches. Supporting PHP versions for CodeIgniter 3
|
Pocketarc Fork already works with PHP 8.3 without any issues. You just have to adapt your own code where needed: |
Quoting jamieburchell below from #6173 The releases from this fork appear to be based on the IMO it would be better to cherry-pick and apply specific fixes to the latest actual release/master if you want to keep as close as possible to the last official 3.1.13 release. |
Ty for your effor tfirst of all ! Second, I am not a senior so I would not want to do some mistakes, but do it step by step with some help if possilble. Also, how should I best test the changes ?
Furthermore, in the official 8.1 and 3.13 I have no issues with the code. Thank you ! |
I'm running with those exact changes in multiple projects without issues. You don't have to go out of your way to test the changes, every commit to the branch is tested and backwards compatible, see here. Don't overcomplicate the changes, you're only creating more work for yourself if in case you introduce bugs to the system files. If you don't want to move away from the official release, have faith on the maintainer(s) to introduce support for PHP +8.2 and wait. |
@jafjaf appreciate your answer but I am not very savy in moving in and out of commits. Besides system and application folder and their files, is there any other folder I should check for modifications ? Do I also need to modify many of my models, views, controllers manually too ? ps. Besides here I didn't find anythink regarding mantainer(s) to intrpduce support fpr 8.2+ so the wiat would be in vain. |
You can view all files changed here. All changes are compatible with PHP 5 and above. "If I apply those modifications to the files prior to moving to 8.2 (will it crash CI or parts of it ?) ?" Are you suggesting to implement all the changes straight to production? Don't, Always test before with multiple versions to ensure compatibility. "Do I also need to modify many of my models, views, controllers manually too ?" Depends on how your code looks, if you're using deprecated functions you have to update them as well. If the changes scare you that much you can always migrate to Codeigniter 4, which have support for PHP +8 |
The first link is what I needed. Is this #[AllowDynamicProperties] causing any issue as I did not see it in developer branch (there are some modifications here I wouldn't put as they are over my head and I don't think I need them) I am in 8.2 now. Will the changes from the master branch be enough for 8.3 ? Did you test it ? Ty again for your patience and answers ! |
Is it even necessary to set this at all? Usually the issue comes from the fact properties are added to a class that doesn't have a property for it to begin with, but nothing stops you from just adding the property and leaving it empty until the code requires it. I have a few libraries that utilize dynamic properties and I did just that, adding properties to the classes and so far I can't see any adverse effects of that. It's a bit silly, but I suspect it has some security implications to not allow randomly adding things to classes that were not meant to be there in the first place. |
It's necessary as we don't always know what the properties are so we can't pre-define them. Consider, for example, the following code from the CI_Controller class constructor (
or the following from the CI_Loader class (
|
@Tampa It is not necessary to be able to add random properties as you say. |
I wanted to use PHP 8.3 with CI 3.1.13
I've installed PHP 8.3 and it gives the following error.
The text was updated successfully, but these errors were encountered: