Welcome Guest, Not a member yet? Register   Sign In
Creation of dynamic property Config\Cache::$file is deprecated
#1

Hi
I'm having some problems after upgrading PHP in a server
I'm getting an exception

Code:
Creation of dynamic property Config\Cache::$file is deprecated

I've also upgraded CodeIgniter and have followed all the corresponding upgrade guide's steps from 4.2.10 up to 4.3.3

[Image: pgxvdRC.jpg]

[Image: pLaHZz3.jpg]

Any advise? Thanks
Reply
#2

(This post was last modified: 04-24-2023, 10:18 AM by JustJohnQ.)

https://php.watch/versions/8.2/dynamic-p...deprecated

Also read this post for a temporary solution:
https://forum.codeigniter.com/showthread...properties

Just realized now that it’s an error in a system file so my above posts might not help you.
Reply
#3

it looks like your on Linux

Code:
rm -rf   vendor

So you removed dir vendor and contents. I don't do that when i update ; out of interest t what was the thinking behind doing that ?

But the depreciated from my cursory look seems to be that classes have to have all properties defined.

so i think that exception might be to do with: https://php.watch/versions/8.2/dynamic-p...deprecated
CMS CI4     I use Arch Linux by the way 

Reply
#4

Fixing that error is very easy. Just add the property in the class.
https://github.com/codeigniter4/CodeIgni...#L111-L114

But I don't know why your Config\Cache does not have the $file.
Reply
#5

(04-24-2023, 12:00 PM)captain-sensible Wrote: it looks like your on Linux 

Code:
rm -rf  vendor

So you removed  dir vendor and contents. I don't do that when i update ; out of interest t what was the thinking behind doing that ?

But the depreciated  from my cursory  look seems to be that classes have to have all  properties defined.

so  i think  that exception might be to do with: https://php.watch/versions/8.2/dynamic-p...deprecated

removing vendor and reinstalling; upgrading composer; etc. were listed as steps for upgrading from 4.2.10 to 4.3.3


(04-24-2023, 03:56 PM)kenjis Wrote: Fixing that error is very easy. Just add the property in the class.
https://github.com/codeigniter4/CodeIgni...#L111-L114

But I don't know why your Config\Cache does not have the $file.

Yes, I knew that I could solve by adding the property in the class, but also wonder why that class doesn't have the property (even after upgraded)
Reply
#6

`composer update` does not change any your project files. It only updates files under vendor/.
If you created your app with older version of CI4, the config file may not have the property..
Reply
#7

(04-25-2023, 05:38 PM)kenjis Wrote: `composer update` does not change any your project files. It only updates files under vendor/.
If you created your app with older version of CI4, the config file may not have the property..

Yes
I had to do a similar stuff.
I've downloaded a new appStarter project, then moved controllers, models, libraries, views, etc. from old application
Reply
#8

If you don't want to update your project files manually, Tatter\Patches does it automatically.
https://github.com/tattersoftware/codeigniter4-patches
Reply
#9

(04-26-2023, 04:43 AM)kenjis Wrote: If you don't want to update your project files manually, Tatter\Patches does it automatically.
https://github.com/tattersoftware/codeigniter4-patches

Wow, didn't know about it
Thanks a lot for the suggestion
Reply




Theme © iAndrew 2016 - Forum software by © MyBB