|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* This file is part of the ekino Drupal Debug project. |
|
7
|
|
|
* |
|
8
|
|
|
* (c) ekino |
|
9
|
|
|
* |
|
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
11
|
|
|
* file that was distributed with this source code. |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
namespace Ekino\Drupal\Debug\Action\DisplayPrettyExceptionsASAP; |
|
15
|
|
|
|
|
16
|
|
|
use Ekino\Drupal\Debug\Action\ActionWithOptionsInterface; |
|
17
|
|
|
use Ekino\Drupal\Debug\Action\EventSubscriberActionInterface; |
|
18
|
|
|
use Ekino\Drupal\Debug\Kernel\Event\DebugKernelEvents; |
|
19
|
|
|
use Symfony\Component\Debug\Exception\FatalThrowableError; |
|
20
|
|
|
use Symfony\Component\Debug\ExceptionHandler; |
|
|
|
|
|
|
21
|
|
|
|
|
22
|
|
|
class DisplayPrettyExceptionsASAPAction implements EventSubscriberActionInterface, ActionWithOptionsInterface |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* @var DisplayPrettyExceptionsASAPOptions |
|
26
|
|
|
*/ |
|
27
|
|
|
private $options; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* {@inheritdoc} |
|
31
|
|
|
*/ |
|
32
|
1 |
|
public static function getSubscribedEvents(): array |
|
33
|
|
|
{ |
|
34
|
|
|
return array( |
|
35
|
1 |
|
DebugKernelEvents::AFTER_ENVIRONMENT_BOOT => 'process', |
|
36
|
|
|
); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @param DisplayPrettyExceptionsASAPOptions $options |
|
41
|
|
|
*/ |
|
42
|
3 |
|
public function __construct(DisplayPrettyExceptionsASAPOptions $options) |
|
43
|
|
|
{ |
|
44
|
3 |
|
$this->options = $options; |
|
45
|
3 |
|
} |
|
46
|
|
|
|
|
47
|
1 |
|
public function process(): void |
|
48
|
|
|
{ |
|
49
|
|
|
// TODO: https://github.com/symfony/symfony/pull/28954 |
|
50
|
|
|
\set_exception_handler(function (\Throwable $exception): void { |
|
51
|
|
|
if (!$exception instanceof \Exception) { |
|
52
|
|
|
$exception = new FatalThrowableError($exception); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
$exceptionHandler = new ExceptionHandler(true, $this->options->getCharset(), $this->options->getFileLinkFormat()); |
|
56
|
|
|
$exceptionHandler->sendPhpResponse($exception); |
|
57
|
1 |
|
}); |
|
58
|
1 |
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* {@inheritdoc} |
|
62
|
|
|
*/ |
|
63
|
1 |
|
public static function getOptionsClass(): string |
|
64
|
|
|
{ |
|
65
|
1 |
|
return DisplayPrettyExceptionsASAPOptions::class; |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths