Any problems upgrading cake to minor version only?


I’ve been building a site on cakePHP 3.1.0. It’s due to go live soon (ish) and I want to upgrade to the latest version of cake before that.

The problem is that cake is now up to 3.3, which requires PHP 5.5.9, while the production server is still running only PHP 5.4.45. In the longer term PHP will need to be upgraded on the server, but as this will impact on the sites already live on there this won’t be happening immediately.

In the meantime, I will need to get my new site live.

What is the best approach here? I was thinking of changing the setting for cakephp in composer.json in the skeleton app to “~3.1.0”, which will presumably mean composer will upgrade to the latest 3.1.x version. I assume that then I will at least get the security fixes etc, plus upgrades for other required packages like Carbon.

Is this approach likely to cause any problems? Has anyone used this kind of approach successfully?

Is there a better way?

Thanks for your help!

Hey Stu3345,

I’ve been using CakePHP 3 since it was first released last year and I have not noticed any major complications that affected it other than showing some deprecation messages within debug mode which can easily be fixed (ex. changing layout within controller). Third party plugins on the other hand have proven to be a different matter however so you may want to review any cake plugins you may be using first.

Are you using git and/or PHPunit by chance? I would recommend running a test environment on your local machine and upgrade using a simple composer update command. You can easily host a local cakephp server by running the bin/cake server command so you won’t need to configure apache/iis during testing. From your local system you would then run your unit and integration test as well as run through the application manually to make sure everything is ok.

Again, I haven’t found any major changes within the versions that would lead my sites to breaking (I maintain four of them) but it’s still good practice to test locally just in case.