comparison vendor/symfony/debug/ErrorHandler.php @ 13:5fb285c0d0e3

Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've been lucky to get away with this so far, as we don't support self-registration which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5 was vulnerable to.
author Chris Cannam
date Mon, 23 Apr 2018 09:33:26 +0100
parents 7a779792577d
children c2387f117808
comparison
equal deleted inserted replaced
12:7a779792577d 13:5fb285c0d0e3
134 $handler = $prev[0]; 134 $handler = $prev[0];
135 $replace = false; 135 $replace = false;
136 } 136 }
137 if (!$replace && $prev) { 137 if (!$replace && $prev) {
138 restore_error_handler(); 138 restore_error_handler();
139 } 139 $handlerIsRegistered = is_array($prev) && $handler === $prev[0];
140 if (is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] === $handler) { 140 } else {
141 $handlerIsRegistered = true;
142 }
143 if (is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) {
141 restore_exception_handler(); 144 restore_exception_handler();
145 if (!$handlerIsRegistered) {
146 $handler = $prev[0];
147 } elseif ($handler !== $prev[0] && $replace) {
148 set_exception_handler(array($handler, 'handleException'));
149 $p = $prev[0]->setExceptionHandler(null);
150 $handler->setExceptionHandler($p);
151 $prev[0]->setExceptionHandler($p);
152 }
142 } else { 153 } else {
143 $handler->setExceptionHandler($prev); 154 $handler->setExceptionHandler($prev);
144 } 155 }
145 156
146 $handler->throwAt(E_ALL & $handler->thrownErrors, true); 157 $handler->throwAt(E_ALL & $handler->thrownErrors, true);
566 $exception = $e; 577 $exception = $e;
567 break; 578 break;
568 } 579 }
569 } 580 }
570 } 581 }
582 $exceptionHandler = $this->exceptionHandler;
583 $this->exceptionHandler = null;
571 try { 584 try {
572 if (null !== $this->exceptionHandler) { 585 if (null !== $exceptionHandler) {
573 return \call_user_func($this->exceptionHandler, $exception); 586 return \call_user_func($exceptionHandler, $exception);
574 } 587 }
575 $handlerException = $handlerException ?: $exception; 588 $handlerException = $handlerException ?: $exception;
576 } catch (\Exception $handlerException) { 589 } catch (\Exception $handlerException) {
577 } catch (\Throwable $handlerException) { 590 } catch (\Throwable $handlerException) {
578 } 591 }
579 $this->exceptionHandler = null;
580 if ($exception === $handlerException) { 592 if ($exception === $handlerException) {
581 self::$reservedMemory = null; // Disable the fatal error handler 593 self::$reservedMemory = null; // Disable the fatal error handler
582 throw $exception; // Give back $exception to the native handler 594 throw $exception; // Give back $exception to the native handler
583 } 595 }
584 $this->handleException($handlerException); 596 $this->handleException($handlerException);