CakePHP 3.7 and PHP 7.3

What a timing!
Soon both these minors will land as stable versions.

CakePHP 3.7

Let’s talk about this minor first. RC-2 has just landed.
The changelog towards master (3.6) shows, that the changes are not too much, it is basically a last kind of bridge towards a 4.0.
This is a diff of the book versions, and the 3.7 migration guide mainly lists a lot of new deprecations, nothing critical
to updating as it will continue to work until 4.0.

Try it now

You should upgrade your apps and plugins now in a separate branch/PR and let CI and manual testing determine if there are any BC breaks that need to be reported.
Do so early, as this is the best chance to get all found issues covered in time for the stable release.

Note that if you composer require --update-with-dependencies "cakephp/cakephp:3.7.0-RC2", you might also need to switch some core plugins, like DebugKit, to the 3.next branch here. Or you just disable it for the test.

For the beginning best to also disable deprecations in your config (E_ALL & ~E_USER_DEPRECATED) so you can actually test the relevant topics for compatibility.
All method name upgrades can be done separately also weeks later, no need to dive into all at once.

For me, all worked flawlessly. My apps were immediately working again (with deprecations silenced), also almost all plugins were fine.

Apropos Plugins

Try to keep compatibility for 3.6 just for a few more months if you can.
Don’t directly hardcode ^3.7 if you don’t use any of its new functionality, as you otherwise force everyone using it to upgrade everything in order to get the latest bugfixes. It can also create deadlocks if multiple plugins have been locked to it, while others aren’t upgraded yet.
Best to remove all deprecations from 3.5 and below and otherwise silence the deprecations for it inside the config and keep it compatible for both minors for some time.

Tooling

As mentioned in my previous post for 3.6 release, you should definitely provide a CI check for your plugins in terms of minimum version compatibility. Especially if you do support multiple minors, it is easy to miss a newly added method being used.
Also check the other tips there, as they all still bear valuable tips.

PHP 7.3

This PHP minor will also introduce only slight changes, mostly to make PHP a bit more strict and issue warnings for obvious issues a bit immediate.
In many cases, your application will be compatible.

Look out for your code around

  • Regular expressions (Using - in the middle of [] character groups)
  • compact() usage with undefined variables
  • String search functions with integer needle (I could actually fix a few lines of code this way even! See e.g. this missed check throwing a warning now)

Adjust your CI matrix

I already adjusted my Travis CI matrixes for including PHP 7.3 in the builds.

If you still support PHP5.6, I recommend not to have the full list of each minor, but use min/max for PHP7 here:

php:
  - 5.6
  - 7.0
  - 7.3

Especially if you also test multiple DB types per PHP version, this cuts down on the builds to be run.
And seriously, if 7.0 as well as the latest minor works, then most certainly all the minors in between are also just fine.

I sometimes also like to combine versions and DB types, so each handles one, this also cuts down on too many jobs here per commit.

Help the Community

You have a bit of time and are unsure where to help out?
As just mentioned, many ecosystem libraries – and especially plugins – will need some love. Check the awesome list for some of the more popular and frequently used ones, or just pick your favorites.
You can fork them, prepare the adjustments, see if Travis report is green and make a PR to the upstream repository.
For simple checks, you can even do all of that simply in the browser these days 🙂

The maintainers of plugins really love if people contribute back and take a bit of the maintenance overhead away.
I sure am.

You can also check the core issues and PRs and see if you might be able to help to get things done directly in the CakePHP core.
Specifically, take a look at the 3.7 milestone here.

Thank you! And happy baking.

5.00 avg. rating (93% score) - 1 vote

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.