CodeIgniter Forums
Cache Exception after Update - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Cache Exception after Update (/showthread.php?tid=88811)



Cache Exception after Update - konkret - 11-12-2023

Hello,
I updated codeigniter via composer and since then I get the following error:
Code:
PHP Fatal error:  Uncaught TypeError: Cannot assign null to property CodeIgniter\CodeIgniter::$pageCache of type CodeIgniter\Cache\ResponseCache in /data/web/e63506/html/apps/07_codeigniter/vendor/codeigniter4/framework/system/CodeIgniter.php:196
Stack trace:
#0 /data/web/e63506/html/apps/07_codeigniter/system/Config/Services.php(154): CodeIgniter\CodeIgniter->__construct()
#1 /data/web/e63506/html/apps/07_codeigniter/system/Config/BaseService.php(252): CodeIgniter\Config\Services::codeigniter()
#2 /data/web/e63506/html/apps/07_codeigniter/system/Config/BaseService.php(193): CodeIgniter\Config\BaseService::__callStatic()
#3 /data/web/e63506/html/apps/07_codeigniter/system/Config/Services.php(149): CodeIgniter\Config\BaseService::getSharedInstance()
#4 /data/web/e63506/html/apps/07_codeigniter/system/Config/BaseService.php(252): CodeIgniter\Config\Services::codeigniter()
#5 /data/web/e63506/html/apps/07_codeigniter/index.php(54): CodeIgniter\Config\BaseService::__callStatic()
#6 {main}
  thrown in /data/web/e63506/html/apps/07_codeigniter/vendor/codeigniter4/framework/system/CodeIgniter.php on line 196

Does anyone have an idea what I could do?
BR konkret


RE: Cache Exception after Update - kenjis - 11-14-2023

It seems you failed to update CI properly.

Cannot assign null to property CodeIgniter\CodeIgniter::$pageCache of type CodeIgniter\Cache\ResponseCache in /data/web/e63506/html/apps/07_codeigniter/vendor/codeigniter4/framework/system/CodeIgniter.php:196

Why is null assigned?


RE: Cache Exception after Update - konkret - 11-14-2023

The solution was very simple.

Just made a clean new installation and copied my files (Controllers, Models, etc..) there.

BR konkret


RE: Cache Exception after Update - konkret - 11-14-2023

Now I also got the original version to run, just a few steps were needed:
- set new systemDirectory path in "Config/Paths.php"
- new index.php in "public" folder needed
- Routing.php and Routes.php in "Config" folder needed
- set right Path for aliases in "Config/Filters"
- update URI handling if needed:

e.g.:
PHP Code:
$uri->getSegment(2) == 'xyz' 
to
PHP Code:
e.g.: $uri->getTotalSegments() >= && $uri->getSegment(1) == 'xyz' 

Check also this upgrade guide:
https://codeigniter4.github.io/userguide/installation/upgrade_440.html


RE: Cache Exception after Update - kenjis - 11-14-2023

Yes, whenever you update the framework, you should check the all upgrade guides that affect you:
https://codeigniter4.github.io/userguide/installation/upgrading.html