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.
This commit is contained in:
Lucas Bickel 2017-06-07 17:33:23 +02:00
parent 9d5d866db6
commit d6a5cbd02e
1 changed files with 1 additions and 1 deletions

View File

@ -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',