diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2025-02-18 14:24:44 +0000 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2025-02-19 09:59:41 +0000 |
| commit | 83e2954d87c247d8e127eeabeff8381ec18f2e68 (patch) | |
| tree | 38280f2885caa2ef8bc0b90f28af108972d4370d /app/Webtrees.php | |
| parent | 22be2c1c7c1b6608ec8c55bae32f57d3234973cf (diff) | |
| download | webtrees-83e2954d87c247d8e127eeabeff8381ec18f2e68.tar.gz webtrees-83e2954d87c247d8e127eeabeff8381ec18f2e68.tar.bz2 webtrees-83e2954d87c247d8e127eeabeff8381ec18f2e68.zip | |
Merge some changes from 2.2
Diffstat (limited to 'app/Webtrees.php')
| -rw-r--r-- | app/Webtrees.php | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/app/Webtrees.php b/app/Webtrees.php index 17d2bd72d3..cf1136fcaf 100644 --- a/app/Webtrees.php +++ b/app/Webtrees.php @@ -59,6 +59,7 @@ use Fisharebest\Webtrees\Http\Middleware\CompressResponse; use Fisharebest\Webtrees\Http\Middleware\ContentLength; use Fisharebest\Webtrees\Http\Middleware\DoHousekeeping; use Fisharebest\Webtrees\Http\Middleware\EmitResponse; +use Fisharebest\Webtrees\Http\Middleware\ErrorHandler; use Fisharebest\Webtrees\Http\Middleware\HandleExceptions; use Fisharebest\Webtrees\Http\Middleware\LoadRoutes; use Fisharebest\Webtrees\Http\Middleware\NoRouteFound; @@ -156,6 +157,7 @@ class Webtrees public const GEDCOM_PDF = 'https://webtrees.net/downloads/gedcom-5-5-1.pdf'; private const MIDDLEWARE = [ + ErrorHandler::class, EmitResponse::class, ReadConfigIni::class, BaseUrl::class, @@ -183,14 +185,11 @@ class Webtrees /** * Initialise the application. - * - * @return void */ - public function bootstrap(): void + public function bootstrap(): self { // Show all errors and warnings in development, fewer in production. error_reporting(self::ERROR_REPORTING); - set_error_handler($this->phpErrorHandler()); // All modern software uses UTF-8 encoding. mb_internal_encoding('UTF-8'); @@ -228,12 +227,12 @@ class Webtrees Registry::xrefFactory(new XrefFactory()); stream_filter_register(GedcomEncodingFilter::class, GedcomEncodingFilter::class); + + return $this; } /** * Respond to a CLI request. - * - * @return void */ public function cliRequest(): void { @@ -242,8 +241,6 @@ class Webtrees /** * Respond to an HTTP request. - * - * @return ResponseInterface */ public function httpRequest(): ResponseInterface { @@ -276,26 +273,6 @@ class Webtrees return $dispatcher->dispatch($request); } - /** - * An error handler that can be passed to set_error_handler(). - * - * @return Closure(int,string,string,int):bool - */ - private function phpErrorHandler(): Closure - { - return static function (int $errno, string $errstr, string $errfile, int $errline): bool { - // Ignore errors that are silenced with '@' - if ((error_reporting() & $errno) !== 0) { - throw new ErrorException($errstr, 0, $errno, $errfile, $errline); - } - - return true; - }; - } - - /** - * @return ContainerInterface - */ public static function container(): ContainerInterface { return Container::getInstance(); |
