Home » Php » Is Zend Framework 1 compatible with PHP 7.2?

Is Zend Framework 1 compatible with PHP 7.2?

Posted by: admin July 12, 2020 Leave a comment


I have a project built in Zend Framework 1. With PHP up to 7.1, it works fine. When I upgraded PHP on one of the testing servers, it shows an internal error:

Fatal error: Declaration of Zend_Rest_Route::assemble($data = Array, $reset = false, $encode = true) must be compatible with Zend_Controller_Router_Route_Module::assemble($data = Array, $reset = false, $encode = true, $partial = false) in /public_html/library/Zend/Rest/Route.php on line 52

It appears that both classes belong to the framework. Version of ZF1 installed is 1.12.18.

Is there a version of ZF1 compatible with PHP 7.2? Or is upgrade to ZF2 unavoidable to maintain compatibility?

How to&Answers:

Yes, the error is caused by a tightening of PHP’s inheritance model, so if the framework code is failing with this error in PHP 7.2 then the answer is that the framework is not compatible with 7.2, at least not without fixing this (and other similar) errors.

This error definitely looks like it’s going to be a show stopper for you, and Zend 1 is no longer maintained, so I guess the simple answer is you’re going to have to either upgrade Zend or not upgrade PHP.

Your other alternative would be to fork Zend yourself and fix the compatibility issues. Or there may be community forks by others who have done the same thing. I really wouldn’t recommend that though. At some point you’re going to have to bite the bullet and upgrade; it’ll get harder to do the longer you leave it, so you may as well do it now.


Zend Framework 1 has reached its end of life, but some forks have been done. Shardj‘s one is compatible with PHP 7.3.