From d6a5cbd02e9ffc5950337301a77c1326d01341ac Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Wed, 7 Jun 2017 17:33:23 +0200 Subject: [PATCH] Remove assert() from rest module bootstrap Problem: assert() is Language construct in php 7 and not a function anymore. It also seems to behave silghtly differently with regards to what kind of side effects assertions are allowed to have. This leads to all of the rest endpoints being broken in php 7 since the assertion silently fails and the routes never really get added to the front controllers router. Solution: Don't wrap the addRouter call in assert(). The way assert was being uses was rather unusual for php code this age. It was also mostly checking zf1 rather than guarding against errors in LibreTime itself. The php manual clearly states "As a rule of thumb your code should always be able to work correctly if assertion checking is not activated." giving even more reason to ot wrap critical paths in assertions. There are some other instances of `assert()` being used in non test code, those don't seem to have any negative effects on php7. --- airtime_mvc/application/modules/rest/Bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/modules/rest/Bootstrap.php b/airtime_mvc/application/modules/rest/Bootstrap.php index 3ad53e846..b8575a2cf 100644 --- a/airtime_mvc/application/modules/rest/Bootstrap.php +++ b/airtime_mvc/application/modules/rest/Bootstrap.php @@ -9,7 +9,7 @@ class Rest_Bootstrap extends Zend_Application_Module_Bootstrap $restRoute = new Zend_Rest_Route($front, array(), array( 'rest'=> array('media', 'show-image', 'podcast', 'podcast-episodes'))); - assert($router->addRoute('rest', $restRoute)); + $router->addRoute('rest', $restRoute); $podcastBulkRoute = new Zend_Controller_Router_Route( 'rest/podcast/bulk',