diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-08-27 12:04:36 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-08-27 12:04:36 +0200 |
commit | 7e3dc0ba98bf019c2804e5c74fb6061b16fb712f (patch) | |
tree | f0a333e9e009d78d59c1e4823f766625bc2bb255 /application/container | |
parent | af41d5ab5d2bd3ba64d052c997bc6afa6966a63c (diff) | |
download | Shaarli-7e3dc0ba98bf019c2804e5c74fb6061b16fb712f.tar.gz Shaarli-7e3dc0ba98bf019c2804e5c74fb6061b16fb712f.tar.zst Shaarli-7e3dc0ba98bf019c2804e5c74fb6061b16fb712f.zip |
Better handling of plugin incompatibility
If a PHP is raised while executing plugin hook, Shaarli will display an error instead of rendering the error page (or just ending in fatal error for default hooks).
Also added phpErrorHandler which is handled differently that regular errorHandler by Slim.:
Diffstat (limited to 'application/container')
-rw-r--r-- | application/container/ContainerBuilder.php | 3 | ||||
-rw-r--r-- | application/container/ShaarliContainer.php | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/application/container/ContainerBuilder.php b/application/container/ContainerBuilder.php index 4a1a6ea7..58067c99 100644 --- a/application/container/ContainerBuilder.php +++ b/application/container/ContainerBuilder.php | |||
@@ -152,6 +152,9 @@ class ContainerBuilder | |||
152 | $container['errorHandler'] = function (ShaarliContainer $container): ErrorController { | 152 | $container['errorHandler'] = function (ShaarliContainer $container): ErrorController { |
153 | return new ErrorController($container); | 153 | return new ErrorController($container); |
154 | }; | 154 | }; |
155 | $container['phpErrorHandler'] = function (ShaarliContainer $container): ErrorController { | ||
156 | return new ErrorController($container); | ||
157 | }; | ||
155 | 158 | ||
156 | return $container; | 159 | return $container; |
157 | } | 160 | } |
diff --git a/application/container/ShaarliContainer.php b/application/container/ShaarliContainer.php index c4fe753e..9a9a974a 100644 --- a/application/container/ShaarliContainer.php +++ b/application/container/ShaarliContainer.php | |||
@@ -4,7 +4,6 @@ declare(strict_types=1); | |||
4 | 4 | ||
5 | namespace Shaarli\Container; | 5 | namespace Shaarli\Container; |
6 | 6 | ||
7 | use http\Cookie; | ||
8 | use Shaarli\Bookmark\BookmarkServiceInterface; | 7 | use Shaarli\Bookmark\BookmarkServiceInterface; |
9 | use Shaarli\Config\ConfigManager; | 8 | use Shaarli\Config\ConfigManager; |
10 | use Shaarli\Feed\FeedBuilder; | 9 | use Shaarli\Feed\FeedBuilder; |
@@ -30,7 +29,7 @@ use Slim\Container; | |||
30 | * @property CookieManager $cookieManager | 29 | * @property CookieManager $cookieManager |
31 | * @property ConfigManager $conf | 30 | * @property ConfigManager $conf |
32 | * @property mixed[] $environment $_SERVER automatically injected by Slim | 31 | * @property mixed[] $environment $_SERVER automatically injected by Slim |
33 | * @property callable $errorHandler Overrides default Slim error display | 32 | * @property callable $errorHandler Overrides default Slim exception display |
34 | * @property FeedBuilder $feedBuilder | 33 | * @property FeedBuilder $feedBuilder |
35 | * @property FormatterFactory $formatterFactory | 34 | * @property FormatterFactory $formatterFactory |
36 | * @property History $history | 35 | * @property History $history |
@@ -39,6 +38,7 @@ use Slim\Container; | |||
39 | * @property NetscapeBookmarkUtils $netscapeBookmarkUtils | 38 | * @property NetscapeBookmarkUtils $netscapeBookmarkUtils |
40 | * @property PageBuilder $pageBuilder | 39 | * @property PageBuilder $pageBuilder |
41 | * @property PageCacheManager $pageCacheManager | 40 | * @property PageCacheManager $pageCacheManager |
41 | * @property callable $phpErrorHandler Overrides default Slim PHP error display | ||
42 | * @property PluginManager $pluginManager | 42 | * @property PluginManager $pluginManager |
43 | * @property SessionManager $sessionManager | 43 | * @property SessionManager $sessionManager |
44 | * @property Thumbnailer $thumbnailer | 44 | * @property Thumbnailer $thumbnailer |