diff --git a/index.php b/index.php index d200c0e4..5251436e 100644 --- a/index.php +++ b/index.php @@ -80,10 +80,6 @@ $whitelist_default = array( try { - Bridge::setDir(PATH_LIB_BRIDGES); - Format::setDir(PATH_LIB_FORMATS); - Cache::setDir(PATH_LIB_CACHES); - if(!file_exists(WHITELIST_FILE)) { $whitelist_selection = $whitelist_default; $whitelist_write = implode("\n", $whitelist_default); diff --git a/lib/rssbridge.php b/lib/rssbridge.php index c0ab675f..b82f7fe8 100644 --- a/lib/rssbridge.php +++ b/lib/rssbridge.php @@ -35,3 +35,14 @@ require_once PATH_LIB . 'contents.php'; // Vendor require_once PATH_LIB_VENDOR . 'simplehtmldom/simple_html_dom.php'; require_once PATH_LIB_VENDOR . 'php-urljoin/src/urljoin.php'; + +// Initialize static members +try { + Bridge::setDir(PATH_LIB_BRIDGES); + Format::setDir(PATH_LIB_FORMATS); + Cache::setDir(PATH_LIB_CACHES); +} catch(Exception $e) { + error_log($e); + header('Content-type: text/plain', true, 500); + die($e->getMessage()); +} diff --git a/tests/BridgeImplementationTest.php b/tests/BridgeImplementationTest.php index fea38768..0261f58c 100644 --- a/tests/BridgeImplementationTest.php +++ b/tests/BridgeImplementationTest.php @@ -4,9 +4,7 @@ use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestResult; use PHPUnit\Framework\AssertionFailedError; -require_once(__DIR__ . '/../lib/rssbridge.php'); - -Bridge::setDir(PATH_LIB_BRIDGES); +require_once __DIR__ . '/../lib/rssbridge.php'; /** * This class checks bridges for implementation details: