1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-08 17:46:34 +02:00

Catch Errors in order to display a message in more cases. We also catch Exceptions to maintain compat with php 5.

Add check for simplexml extension.
This commit is contained in:
teromene
2018-04-04 19:02:40 +01:00
parent df6da837dc
commit ac6847045c
2 changed files with 17 additions and 5 deletions

View File

@@ -77,6 +77,9 @@ if(!extension_loaded('libxml'))
if(!extension_loaded('mbstring'))
die('"mbstring" extension not loaded. Please check "php.ini"');
if(!extension_loaded('simplexml'))
die('"simplexml" extension not loaded. Please check "php.ini"');
// configuration checks
if(ini_get('allow_url_fopen') !== "1")
die('"allow_url_fopen" is not set to "1". Please check "php.ini');
@@ -199,10 +202,14 @@ try {
$bridge->setCache($cache);
$bridge->setCacheTimeout($cache_timeout);
$bridge->setDatas($params);
} catch(Exception $e) {
} catch(Error $e) {
http_response_code($e->getCode());
header('Content-Type: text/html');
die(buildBridgeException($e, $bridge));
} catch(Exception $e) {
http_response_code($e->getCode());
header('Content-Type: text/html');
die(buildBridgeException($e, $bridge));
}
// Data transformation
@@ -211,11 +218,16 @@ try {
$format->setItems($bridge->getItems());
$format->setExtraInfos($bridge->getExtraInfos());
$format->display();
} catch(Exception $e) {
} catch(Error $e) {
http_response_code($e->getCode());
header('Content-Type: text/html');
die(buildTransformException($e, $bridge));
}
} catch(Exception $e) {
http_response_code($e->getCode());
header('Content-Type: text/html');
die(buildBridgeException($e, $bridge));
}
die;
}