diff options
| author | Greg Roach <fisharebest@gmail.com> | 2018-01-20 15:42:40 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2018-01-20 20:48:40 +0000 |
| commit | 04a1fb9a2dda0ec2222e0264c283aee03fe6e3f1 (patch) | |
| tree | fce56e49da7076eec453b8fc0bbec28b91419420 /includes | |
| parent | 607bcdb6231ed8885186ecf166a26b1af6869504 (diff) | |
| download | webtrees-04a1fb9a2dda0ec2222e0264c283aee03fe6e3f1.tar.gz webtrees-04a1fb9a2dda0ec2222e0264c283aee03fe6e3f1.tar.bz2 webtrees-04a1fb9a2dda0ec2222e0264c283aee03fe6e3f1.zip | |
Use filp/whoops to display errors
Diffstat (limited to 'includes')
| -rw-r--r-- | includes/session.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/includes/session.php b/includes/session.php index 7d0ac50fbb..27dddd56d3 100644 --- a/includes/session.php +++ b/includes/session.php @@ -16,6 +16,7 @@ namespace Fisharebest\Webtrees; use DateTime; +use ErrorException; use Fisharebest\Webtrees\Theme\AdministrationTheme; use League\Flysystem\Adapter\Local; use League\Flysystem\Filesystem; @@ -119,6 +120,14 @@ define('WT_BASE_URL', $base_uri); // What is the name of the requested script. define('WT_SCRIPT_NAME', basename(Filter::server('SCRIPT_NAME'))); +// Convert PHP errors into exceptions +set_error_handler(function ($errno, $errstr, $errfile, $errline) { + // Ignore errors thar are silenced with '@' + if (error_reporting() & $errno) { + throw new ErrorException($errfile . ':' . $errline . ' ' . $errstr, $errno); + } +}); + set_exception_handler(function (Throwable $ex) { $message = $ex->getFile() . ':' . $ex->getLine() . ' ' . $ex->getMessage() . PHP_EOL; |
