Hi!
I'm trying to update my current project from 1.7 to 1.8. What do I have to change so that it does not break?
Hi!
I'm trying to update my current project from 1.7 to 1.8. What do I have to change so that it does not break?
most features will still work with legacy code. try it out on your test environment and read the ZF change log. one important thing is that the loader works differently now. especially if you're using autoload.
Until 1.7
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
Since 1.8
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
$loader->registerNamespace('Namespace_');
Short answer:
Run your test suite and check the results ;)
Long answer:
I remember two points where backward compatibility was broken:
If your bootstrapping does not set the Zend_Locale correctly, ZF >= 1.7.2 will throw an exception that it cannot detect the browsers Locale if you run a script via console.
In Zend Framework 1.8 the constructor of Zend_Controller_Action was modified.
I have to mention this, because it broke my application until I found this error out after hours of debugging (for some reason xDebug nor PHP itself showed me that the constructor in my custom Controller_Action class was not the same as in Zend_Controller_Action anymore).
So have to change your constructor from
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, $invokeArgs = array())
to
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())