19 declare(strict_types=1);
44 private readonly array $sensitive_data = []
50 foreach ($key_value_pairs as $key => &$value) {
51 if (is_array($value)) {
55 if (is_string($value) && in_array($key, $this->sensitive_data,
true)) {
56 $value =
'REMOVED FOR SECURITY';
59 if ($key ===
'PHPSESSID' && is_string($value)) {
60 $value = substr($value, 0, 5) .
' (SHORTENED FOR SECURITY)';
63 if ($key ===
'HTTP_COOKIE') {
64 $cookie_content = explode(
';', $value);
65 foreach ($cookie_content as &$cookie_pair_string) {
66 $cookie_pair = explode(
'=', $cookie_pair_string);
67 if (trim($cookie_pair[0]) === session_name()) {
68 $cookie_pair[1] = substr($cookie_pair[1], 0, 5) .
' (SHORTENED FOR SECURITY)';
69 $cookie_pair_string = implode(
'=', $cookie_pair);
72 $value = implode(
';', $cookie_content);
76 return $key_value_pairs;
88 if (defined(
"IL_INITIAL_WD")) {
102 $this->current_handler = $this->error_handling->getHandler();
103 $this->current_handler->setRun($this->getRun());
104 $this->current_handler->setException($this->getException());
105 $this->current_handler->setInspector($this->getInspector());
106 return $this->current_handler->handle();
115 if ($this->current_handler ===
null ||
116 !method_exists($this->current_handler,
'contentType')) {
120 return $this->current_handler->contentType();
contentType()
This is an implicit interface method of the Whoops handlers.
handle()
Last missing method from HandlerInterface.
__construct(private readonly ilErrorHandling $error_handling, private readonly array $sensitive_data=[])
HandlerInterface $current_handler
A Whoops error handler that delegates calls on it self to another handler that is created only in the...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
hideSensitiveData(array $key_value_pairs)