An unofficial port of CakePHP 1.3.21 to PHP 7.3.
- Make sure your code is PHP 7.3 ready. php7cc is a good start, just exclude the cake-directory in your scans.
- If you made any changes in the cake-directory, that you want to reapply in the PHP 7-version, write them down.
- Delete your cake-directory.
- Copy only the cake-directory from this repository to your existing installation.
- Reapply the changes you wrote down in step 2.
- Find and fix problems related to the changes described below.
Porting CakePHP to PHP 7.3 required the introduction of some breaking changes. Make sure you update your own code according to the following changes:
Two classes had to be renamed:
- The class
String
has been renamed toCakeString
- The class
Object
has been renamed toCakeObject
Three class functions had to be renamed:
JsHelper->value()
has been renamed toJsHelper->jsonValue()
JavascriptHelper->value()
has been renamed toJavascriptHelper->jsonValue()
JsBaseEngineHelper->value()
has been renamed toJsBaseEngineHelper->jsonValue()
One file had to be renamed:
- "cake/libs/error.php" has been renamed to "cake/libs/error_handler.php": Change any
App::import('Core', 'Error')
toApp::import('Core', 'ErrorHandler')
Two database drivers had to be removed:
- "mysql" (replace with "mysqli")
- "mssql"
One configuration variable has to be changed:
- "Security.cipherSeed" must be a valid
int
instead of a string. Make sure, it is small enough to be treated like an int, and not like a float on your system. Otherwise cookies will not be decoded correctly!
The sql-mode ONLY_FULL_GROUP_BY
must be disabled. CakePHP creates queries that are incompatible with this mode.
One new configuration is possible:
- "Session.cookie_samesite" sets the SameSite-cookie-parameter. Defaults to "Lax".
Core-tests have been ported to PHP 7.
To run any tests, you need a Simpletest 1.0.1 version with PHP 7 support in the vendors-directory.
Notes:
- The original CakePHP 1.3 developers noted, that the core-tests cannot be run all at once. You need to run them individually, or they will fail.
- Some core-tests will fail, if you are not using a dedicated test-database. These are shortcomings in the test-cases.
- Some core-tests fail randomly, that's why they are being excluded from travis.
Please issue a pull request if you want to contribute.