Update Config
Once the upgrade tool is done and our environment is ready for upgrade, we need to update config files.
config/app.php (and also in config/app.php.default)
- Enable deprecation warnings:
'Error' => [
'errorLevel' => E_ALL,
]
- Fix
App.paths
:
[
'plugins' => [ROOT . DS . 'plugins' . DS],
'templates' => [ROOT . DS . 'templates' . DS],
'locales' => [RESOURCES . 'locales' . DS],
],
- The default value of
App.uploadedFilesAsObjects
is now true. If your application uses file uploads you can set this flag to false for be compatible with the behavior in 3.x.
'App' => [
// ...
'uploadedFilesAsObjects' => false,
],
config/bootstrap.php and config/bootstrap_cli.php
- Diff the changes between your current version and the bootstrap.php file provided by the current version you are migrating to, for example https://github.com/cakephp/app/blob/4.x/config/bootstrap.php .
- Update your bootstrap.php file to include the changes and match the new defaults.
config/paths.php
- Define RESOURCES constant:
/**
* Path to the resources directory.
*/
define('RESOURCES', ROOT . DS . 'resources' . DS);
Also note that some information included in this guide is also available in the CakePHP Book since we have prepared this document based on official docs and our experience through more than twenty upgrade jobs done.