diff --git a/vendor/symfony/debug/.gitignore b/vendor/symfony/debug/.gitignore
new file mode 100644
index 000000000..c49a5d8df
--- /dev/null
+++ b/vendor/symfony/debug/.gitignore
@@ -0,0 +1,3 @@
+vendor/
+composer.lock
+phpunit.xml
diff --git a/vendor/symfony/debug/BufferingLogger.php b/vendor/symfony/debug/BufferingLogger.php
new file mode 100644
index 000000000..a2ed75b9d
--- /dev/null
+++ b/vendor/symfony/debug/BufferingLogger.php
@@ -0,0 +1,37 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Debug;
+
+use Psr\Log\AbstractLogger;
+
+/**
+ * A buffering logger that stacks logs for later.
+ *
+ * @author Nicolas Grekas
+ */
+class BufferingLogger extends AbstractLogger
+{
+ private $logs = array();
+
+ public function log($level, $message, array $context = array())
+ {
+ $this->logs[] = array($level, $message, $context);
+ }
+
+ public function cleanLogs()
+ {
+ $logs = $this->logs;
+ $this->logs = array();
+
+ return $logs;
+ }
+}
diff --git a/vendor/symfony/debug/CHANGELOG.md b/vendor/symfony/debug/CHANGELOG.md
new file mode 100644
index 000000000..31c67eb60
--- /dev/null
+++ b/vendor/symfony/debug/CHANGELOG.md
@@ -0,0 +1,64 @@
+CHANGELOG
+=========
+
+3.4.0
+-----
+
+* deprecated `ErrorHandler::stackErrors()` and `ErrorHandler::unstackErrors()`
+
+3.3.0
+-----
+
+* deprecated the `ContextErrorException` class: use \ErrorException directly now
+
+3.2.0
+-----
+
+* `FlattenException::getTrace()` now returns additional type descriptions
+ `integer` and `float`.
+
+
+3.0.0
+-----
+
+* removed classes, methods and interfaces deprecated in 2.x
+
+2.8.0
+-----
+
+* added BufferingLogger for errors that happen before a proper logger is configured
+* allow throwing from `__toString()` with `return trigger_error($e, E_USER_ERROR);`
+* deprecate ExceptionHandler::createResponse
+
+2.7.0
+-----
+
+* added deprecations checking for parent interfaces/classes to DebugClassLoader
+* added ZTS support to symfony_debug extension
+* added symfony_debug_backtrace() to symfony_debug extension
+ to track the backtrace of fatal errors
+
+2.6.0
+-----
+
+* generalized ErrorHandler and ExceptionHandler,
+ with some new methods and others deprecated
+* enhanced error messages for uncaught exceptions
+
+2.5.0
+-----
+
+* added ExceptionHandler::setHandler()
+* added UndefinedMethodFatalErrorHandler
+* deprecated DummyException
+
+2.4.0
+-----
+
+ * added a DebugClassLoader able to wrap any autoloader providing a findFile method
+ * improved error messages for not found classes and functions
+
+2.3.0
+-----
+
+ * added the component
diff --git a/vendor/symfony/debug/Debug.php b/vendor/symfony/debug/Debug.php
new file mode 100644
index 000000000..e3665ae5f
--- /dev/null
+++ b/vendor/symfony/debug/Debug.php
@@ -0,0 +1,63 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Debug;
+
+/**
+ * Registers all the debug tools.
+ *
+ * @author Fabien Potencier
+ */
+class Debug
+{
+ private static $enabled = false;
+
+ /**
+ * Enables the debug tools.
+ *
+ * This method registers an error handler and an exception handler.
+ *
+ * If the Symfony ClassLoader component is available, a special
+ * class loader is also registered.
+ *
+ * @param int $errorReportingLevel The level of error reporting you want
+ * @param bool $displayErrors Whether to display errors (for development) or just log them (for production)
+ */
+ public static function enable($errorReportingLevel = E_ALL, $displayErrors = true)
+ {
+ if (static::$enabled) {
+ return;
+ }
+
+ static::$enabled = true;
+
+ if (null !== $errorReportingLevel) {
+ error_reporting($errorReportingLevel);
+ } else {
+ error_reporting(E_ALL);
+ }
+
+ if ('cli' !== PHP_SAPI) {
+ ini_set('display_errors', 0);
+ ExceptionHandler::register();
+ } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {
+ // CLI - display errors only if they're not already logged to STDERR
+ ini_set('display_errors', 1);
+ }
+ if ($displayErrors) {
+ ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
+ } else {
+ ErrorHandler::register()->throwAt(0, true);
+ }
+
+ DebugClassLoader::enable();
+ }
+}
diff --git a/vendor/symfony/debug/DebugClassLoader.php b/vendor/symfony/debug/DebugClassLoader.php
new file mode 100644
index 000000000..9ff826ed0
--- /dev/null
+++ b/vendor/symfony/debug/DebugClassLoader.php
@@ -0,0 +1,384 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Debug;
+
+/**
+ * Autoloader checking if the class is really defined in the file found.
+ *
+ * The ClassLoader will wrap all registered autoloaders
+ * and will throw an exception if a file is found but does
+ * not declare the class.
+ *
+ * @author Fabien Potencier
+ * @author Christophe Coevoet
+ * @author Nicolas Grekas
+ */
+class DebugClassLoader
+{
+ private $classLoader;
+ private $isFinder;
+ private $loaded = array();
+ private static $caseCheck;
+ private static $final = array();
+ private static $finalMethods = array();
+ private static $deprecated = array();
+ private static $internal = array();
+ private static $internalMethods = array();
+ private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
+ private static $darwinCache = array('/' => array('/', array()));
+
+ public function __construct(callable $classLoader)
+ {
+ $this->classLoader = $classLoader;
+ $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
+
+ if (!isset(self::$caseCheck)) {
+ $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
+ $i = strrpos($file, DIRECTORY_SEPARATOR);
+ $dir = substr($file, 0, 1 + $i);
+ $file = substr($file, 1 + $i);
+ $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
+ $test = realpath($dir.$test);
+
+ if (false === $test || false === $i) {
+ // filesystem is case sensitive
+ self::$caseCheck = 0;
+ } elseif (substr($test, -strlen($file)) === $file) {
+ // filesystem is case insensitive and realpath() normalizes the case of characters
+ self::$caseCheck = 1;
+ } elseif (false !== stripos(PHP_OS, 'darwin')) {
+ // on MacOSX, HFS+ is case insensitive but realpath() doesn't normalize the case of characters
+ self::$caseCheck = 2;
+ } else {
+ // filesystem case checks failed, fallback to disabling them
+ self::$caseCheck = 0;
+ }
+ }
+ }
+
+ /**
+ * Gets the wrapped class loader.
+ *
+ * @return callable The wrapped class loader
+ */
+ public function getClassLoader()
+ {
+ return $this->classLoader;
+ }
+
+ /**
+ * Wraps all autoloaders.
+ */
+ public static function enable()
+ {
+ // Ensures we don't hit https://bugs.php.net/42098
+ class_exists('Symfony\Component\Debug\ErrorHandler');
+ class_exists('Psr\Log\LogLevel');
+
+ if (!is_array($functions = spl_autoload_functions())) {
+ return;
+ }
+
+ foreach ($functions as $function) {
+ spl_autoload_unregister($function);
+ }
+
+ foreach ($functions as $function) {
+ if (!is_array($function) || !$function[0] instanceof self) {
+ $function = array(new static($function), 'loadClass');
+ }
+
+ spl_autoload_register($function);
+ }
+ }
+
+ /**
+ * Disables the wrapping.
+ */
+ public static function disable()
+ {
+ if (!is_array($functions = spl_autoload_functions())) {
+ return;
+ }
+
+ foreach ($functions as $function) {
+ spl_autoload_unregister($function);
+ }
+
+ foreach ($functions as $function) {
+ if (is_array($function) && $function[0] instanceof self) {
+ $function = $function[0]->getClassLoader();
+ }
+
+ spl_autoload_register($function);
+ }
+ }
+
+ /**
+ * Loads the given class or interface.
+ *
+ * @param string $class The name of the class
+ *
+ * @return bool|null True, if loaded
+ *
+ * @throws \RuntimeException
+ */
+ public function loadClass($class)
+ {
+ $e = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
+
+ try {
+ if ($this->isFinder && !isset($this->loaded[$class])) {
+ $this->loaded[$class] = true;
+ if ($file = $this->classLoader[0]->findFile($class)) {
+ require $file;
+ }
+ } else {
+ call_user_func($this->classLoader, $class);
+ $file = false;
+ }
+ } finally {
+ error_reporting($e);
+ }
+
+ $exists = class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false);
+
+ if ($class && '\\' === $class[0]) {
+ $class = substr($class, 1);
+ }
+
+ if ($exists) {
+ $refl = new \ReflectionClass($class);
+ $name = $refl->getName();
+
+ if ($name !== $class && 0 === strcasecmp($name, $class)) {
+ throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: "%s" vs "%s".', $class, $name));
+ }
+
+ // Don't trigger deprecations for classes in the same vendor
+ if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
+ $len = 0;
+ $ns = '';
+ } else {
+ $ns = substr($name, 0, $len);
+ }
+
+ // Detect annotations on the class
+ if (false !== $doc = $refl->getDocComment()) {
+ foreach (array('final', 'deprecated', 'internal') as $annotation) {
+ if (false !== strpos($doc, '@'.$annotation) && preg_match('#\n \* @'.$annotation.'(?:( .+?)\.?)?\r?\n \*(?: @|/$)#s', $doc, $notice)) {
+ self::${$annotation}[$name] = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : '';
+ }
+ }
+ }
+
+ $parentAndTraits = class_uses($name, false);
+ if ($parent = get_parent_class($class)) {
+ $parentAndTraits[] = $parent;
+
+ if (isset(self::$final[$parent])) {
+ @trigger_error(sprintf('The "%s" class is considered final%s. It may change without further notice as of its next major version. You should not extend it from "%s".', $parent, self::$final[$parent], $name), E_USER_DEPRECATED);
+ }
+ }
+
+ // Detect if the parent is annotated
+ foreach ($parentAndTraits + $this->getOwnInterfaces($name, $parent) as $use) {
+ if (isset(self::$deprecated[$use]) && strncmp($ns, $use, $len)) {
+ $type = class_exists($name, false) ? 'class' : (interface_exists($name, false) ? 'interface' : 'trait');
+ $verb = class_exists($use, false) || interface_exists($name, false) ? 'extends' : (interface_exists($use, false) ? 'implements' : 'uses');
+
+ @trigger_error(sprintf('The "%s" %s %s "%s" that is deprecated%s.', $name, $type, $verb, $use, self::$deprecated[$use]), E_USER_DEPRECATED);
+ }
+ if (isset(self::$internal[$use]) && strncmp($ns, $use, $len)) {
+ @trigger_error(sprintf('The "%s" %s is considered internal%s. It may change without further notice. You should not use it from "%s".', $use, class_exists($use, false) ? 'class' : (interface_exists($use, false) ? 'interface' : 'trait'), self::$internal[$use], $name), E_USER_DEPRECATED);
+ }
+ }
+
+ // Inherit @final and @internal annotations for methods
+ self::$finalMethods[$name] = array();
+ self::$internalMethods[$name] = array();
+ foreach ($parentAndTraits as $use) {
+ foreach (array('finalMethods', 'internalMethods') as $property) {
+ if (isset(self::${$property}[$use])) {
+ self::${$property}[$name] = array_merge(self::${$property}[$name], self::${$property}[$use]);
+ }
+ }
+ }
+
+ $isClass = class_exists($name, false);
+ foreach ($refl->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $method) {
+ if ($method->class !== $name) {
+ continue;
+ }
+
+ // Method from a trait
+ if ($method->getFilename() !== $refl->getFileName()) {
+ continue;
+ }
+
+ if ($isClass && $parent && isset(self::$finalMethods[$parent][$method->name])) {
+ list($declaringClass, $message) = self::$finalMethods[$parent][$method->name];
+ @trigger_error(sprintf('The "%s::%s()" method is considered final%s. It may change without further notice as of its next major version. You should not extend it from "%s".', $declaringClass, $method->name, $message, $name), E_USER_DEPRECATED);
+ }
+
+ foreach ($parentAndTraits as $use) {
+ if (isset(self::$internalMethods[$use][$method->name])) {
+ list($declaringClass, $message) = self::$internalMethods[$use][$method->name];
+ if (strncmp($ns, $declaringClass, $len)) {
+ @trigger_error(sprintf('The "%s::%s()" method is considered internal%s. It may change without further notice. You should not extend it from "%s".', $declaringClass, $method->name, $message, $name), E_USER_DEPRECATED);
+ }
+ }
+ }
+
+ // Detect method annotations
+ if (false === $doc = $method->getDocComment()) {
+ continue;
+ }
+
+ foreach (array('final', 'internal') as $annotation) {
+ if (false !== strpos($doc, '@'.$annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$)#s', $doc, $notice)) {
+ $message = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : '';
+ self::${$annotation.'Methods'}[$name][$method->name] = array($name, $message);
+ }
+ }
+ }
+
+ if (in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
+ @trigger_error(sprintf('The "%s" class uses the reserved name "%s", it will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
+ }
+ }
+
+ if ($file) {
+ if (!$exists) {
+ if (false !== strpos($class, '/')) {
+ throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class));
+ }
+
+ throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
+ }
+ if (self::$caseCheck) {
+ $real = explode('\\', $class.strrchr($file, '.'));
+ $tail = explode(DIRECTORY_SEPARATOR, str_replace('/', DIRECTORY_SEPARATOR, $file));
+
+ $i = count($tail) - 1;
+ $j = count($real) - 1;
+
+ while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
+ --$i;
+ --$j;
+ }
+
+ array_splice($tail, 0, $i + 1);
+ }
+ if (self::$caseCheck && $tail) {
+ $tail = DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $tail);
+ $tailLen = strlen($tail);
+ $real = $refl->getFileName();
+
+ if (2 === self::$caseCheck) {
+ // realpath() on MacOSX doesn't normalize the case of characters
+
+ $i = 1 + strrpos($real, '/');
+ $file = substr($real, $i);
+ $real = substr($real, 0, $i);
+
+ if (isset(self::$darwinCache[$real])) {
+ $kDir = $real;
+ } else {
+ $kDir = strtolower($real);
+
+ if (isset(self::$darwinCache[$kDir])) {
+ $real = self::$darwinCache[$kDir][0];
+ } else {
+ $dir = getcwd();
+ chdir($real);
+ $real = getcwd().'/';
+ chdir($dir);
+
+ $dir = $real;
+ $k = $kDir;
+ $i = strlen($dir) - 1;
+ while (!isset(self::$darwinCache[$k])) {
+ self::$darwinCache[$k] = array($dir, array());
+ self::$darwinCache[$dir] = &self::$darwinCache[$k];
+
+ while ('/' !== $dir[--$i]) {
+ }
+ $k = substr($k, 0, ++$i);
+ $dir = substr($dir, 0, $i--);
+ }
+ }
+ }
+
+ $dirFiles = self::$darwinCache[$kDir][1];
+
+ if (isset($dirFiles[$file])) {
+ $kFile = $file;
+ } else {
+ $kFile = strtolower($file);
+
+ if (!isset($dirFiles[$kFile])) {
+ foreach (scandir($real, 2) as $f) {
+ if ('.' !== $f[0]) {
+ $dirFiles[$f] = $f;
+ if ($f === $file) {
+ $kFile = $k = $file;
+ } elseif ($f !== $k = strtolower($f)) {
+ $dirFiles[$k] = $f;
+ }
+ }
+ }
+ self::$darwinCache[$kDir][1] = $dirFiles;
+ }
+ }
+
+ $real .= $dirFiles[$kFile];
+ }
+
+ if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
+ && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
+ ) {
+ throw new \RuntimeException(sprintf('Case mismatch between class and real file names: "%s" vs "%s" in "%s".', substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)));
+ }
+ }
+
+ return true;
+ }
+ }
+
+ /**
+ * `class_implements` includes interfaces from the parents so we have to manually exclude them.
+ *
+ * @param string $class
+ * @param string|false $parent
+ *
+ * @return string[]
+ */
+ private function getOwnInterfaces($class, $parent)
+ {
+ $ownInterfaces = class_implements($class, false);
+
+ if ($parent) {
+ foreach (class_implements($parent, false) as $interface) {
+ unset($ownInterfaces[$interface]);
+ }
+ }
+
+ foreach ($ownInterfaces as $interface) {
+ foreach (class_implements($interface) as $interface) {
+ unset($ownInterfaces[$interface]);
+ }
+ }
+
+ return $ownInterfaces;
+ }
+}
diff --git a/vendor/symfony/debug/ErrorHandler.php b/vendor/symfony/debug/ErrorHandler.php
new file mode 100644
index 000000000..aebb740ad
--- /dev/null
+++ b/vendor/symfony/debug/ErrorHandler.php
@@ -0,0 +1,746 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Debug;
+
+use Psr\Log\LogLevel;
+use Psr\Log\LoggerInterface;
+use Symfony\Component\Debug\Exception\ContextErrorException;
+use Symfony\Component\Debug\Exception\FatalErrorException;
+use Symfony\Component\Debug\Exception\FatalThrowableError;
+use Symfony\Component\Debug\Exception\OutOfMemoryException;
+use Symfony\Component\Debug\Exception\SilencedErrorContext;
+use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
+use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
+use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
+use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;
+
+/**
+ * A generic ErrorHandler for the PHP engine.
+ *
+ * Provides five bit fields that control how errors are handled:
+ * - thrownErrors: errors thrown as \ErrorException
+ * - loggedErrors: logged errors, when not @-silenced
+ * - scopedErrors: errors thrown or logged with their local context
+ * - tracedErrors: errors logged with their stack trace
+ * - screamedErrors: never @-silenced errors
+ *
+ * Each error level can be logged by a dedicated PSR-3 logger object.
+ * Screaming only applies to logging.
+ * Throwing takes precedence over logging.
+ * Uncaught exceptions are logged as E_ERROR.
+ * E_DEPRECATED and E_USER_DEPRECATED levels never throw.
+ * E_RECOVERABLE_ERROR and E_USER_ERROR levels always throw.
+ * Non catchable errors that can be detected at shutdown time are logged when the scream bit field allows so.
+ * As errors have a performance cost, repeated errors are all logged, so that the developer
+ * can see them and weight them as more important to fix than others of the same level.
+ *
+ * @author Nicolas Grekas
+ * @author Grégoire Pineau
+ */
+class ErrorHandler
+{
+ private $levels = array(
+ E_DEPRECATED => 'Deprecated',
+ E_USER_DEPRECATED => 'User Deprecated',
+ E_NOTICE => 'Notice',
+ E_USER_NOTICE => 'User Notice',
+ E_STRICT => 'Runtime Notice',
+ E_WARNING => 'Warning',
+ E_USER_WARNING => 'User Warning',
+ E_COMPILE_WARNING => 'Compile Warning',
+ E_CORE_WARNING => 'Core Warning',
+ E_USER_ERROR => 'User Error',
+ E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
+ E_COMPILE_ERROR => 'Compile Error',
+ E_PARSE => 'Parse Error',
+ E_ERROR => 'Error',
+ E_CORE_ERROR => 'Core Error',
+ );
+
+ private $loggers = array(
+ E_DEPRECATED => array(null, LogLevel::INFO),
+ E_USER_DEPRECATED => array(null, LogLevel::INFO),
+ E_NOTICE => array(null, LogLevel::WARNING),
+ E_USER_NOTICE => array(null, LogLevel::WARNING),
+ E_STRICT => array(null, LogLevel::WARNING),
+ E_WARNING => array(null, LogLevel::WARNING),
+ E_USER_WARNING => array(null, LogLevel::WARNING),
+ E_COMPILE_WARNING => array(null, LogLevel::WARNING),
+ E_CORE_WARNING => array(null, LogLevel::WARNING),
+ E_USER_ERROR => array(null, LogLevel::CRITICAL),
+ E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
+ E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
+ E_PARSE => array(null, LogLevel::CRITICAL),
+ E_ERROR => array(null, LogLevel::CRITICAL),
+ E_CORE_ERROR => array(null, LogLevel::CRITICAL),
+ );
+
+ private $thrownErrors = 0x1FFF; // E_ALL - E_DEPRECATED - E_USER_DEPRECATED
+ private $scopedErrors = 0x1FFF; // E_ALL - E_DEPRECATED - E_USER_DEPRECATED
+ private $tracedErrors = 0x77FB; // E_ALL - E_STRICT - E_PARSE
+ private $screamedErrors = 0x55; // E_ERROR + E_CORE_ERROR + E_COMPILE_ERROR + E_PARSE
+ private $loggedErrors = 0;
+ private $traceReflector;
+
+ private $isRecursive = 0;
+ private $isRoot = false;
+ private $exceptionHandler;
+ private $bootstrappingLogger;
+
+ private static $reservedMemory;
+ private static $stackedErrors = array();
+ private static $stackedErrorLevels = array();
+ private static $toStringException = null;
+ private static $silencedErrorCache = array();
+ private static $silencedErrorCount = 0;
+ private static $exitCode = 0;
+
+ /**
+ * Registers the error handler.
+ *
+ * @param self|null $handler The handler to register
+ * @param bool $replace Whether to replace or not any existing handler
+ *
+ * @return self The registered error handler
+ */
+ public static function register(self $handler = null, $replace = true)
+ {
+ if (null === self::$reservedMemory) {
+ self::$reservedMemory = str_repeat('x', 10240);
+ register_shutdown_function(__CLASS__.'::handleFatalError');
+ }
+
+ if ($handlerIsNew = null === $handler) {
+ $handler = new static();
+ }
+
+ if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
+ restore_error_handler();
+ // Specifying the error types earlier would expose us to https://bugs.php.net/63206
+ set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
+ $handler->isRoot = true;
+ }
+
+ if ($handlerIsNew && is_array($prev) && $prev[0] instanceof self) {
+ $handler = $prev[0];
+ $replace = false;
+ }
+ if ($replace || !$prev) {
+ $handler->setExceptionHandler(set_exception_handler(array($handler, 'handleException')));
+ } else {
+ restore_error_handler();
+ }
+
+ $handler->throwAt(E_ALL & $handler->thrownErrors, true);
+
+ return $handler;
+ }
+
+ public function __construct(BufferingLogger $bootstrappingLogger = null)
+ {
+ if ($bootstrappingLogger) {
+ $this->bootstrappingLogger = $bootstrappingLogger;
+ $this->setDefaultLogger($bootstrappingLogger);
+ }
+ $this->traceReflector = new \ReflectionProperty('Exception', 'trace');
+ $this->traceReflector->setAccessible(true);
+ }
+
+ /**
+ * Sets a logger to non assigned errors levels.
+ *
+ * @param LoggerInterface $logger A PSR-3 logger to put as default for the given levels
+ * @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants
+ * @param bool $replace Whether to replace or not any existing logger
+ */
+ public function setDefaultLogger(LoggerInterface $logger, $levels = E_ALL, $replace = false)
+ {
+ $loggers = array();
+
+ if (is_array($levels)) {
+ foreach ($levels as $type => $logLevel) {
+ if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
+ $loggers[$type] = array($logger, $logLevel);
+ }
+ }
+ } else {
+ if (null === $levels) {
+ $levels = E_ALL;
+ }
+ foreach ($this->loggers as $type => $log) {
+ if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
+ $log[0] = $logger;
+ $loggers[$type] = $log;
+ }
+ }
+ }
+
+ $this->setLoggers($loggers);
+ }
+
+ /**
+ * Sets a logger for each error level.
+ *
+ * @param array $loggers Error levels to [LoggerInterface|null, LogLevel::*] map
+ *
+ * @return array The previous map
+ *
+ * @throws \InvalidArgumentException
+ */
+ public function setLoggers(array $loggers)
+ {
+ $prevLogged = $this->loggedErrors;
+ $prev = $this->loggers;
+ $flush = array();
+
+ foreach ($loggers as $type => $log) {
+ if (!isset($prev[$type])) {
+ throw new \InvalidArgumentException('Unknown error type: '.$type);
+ }
+ if (!is_array($log)) {
+ $log = array($log);
+ } elseif (!array_key_exists(0, $log)) {
+ throw new \InvalidArgumentException('No logger provided');
+ }
+ if (null === $log[0]) {
+ $this->loggedErrors &= ~$type;
+ } elseif ($log[0] instanceof LoggerInterface) {
+ $this->loggedErrors |= $type;
+ } else {
+ throw new \InvalidArgumentException('Invalid logger provided');
+ }
+ $this->loggers[$type] = $log + $prev[$type];
+
+ if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
+ $flush[$type] = $type;
+ }
+ }
+ $this->reRegister($prevLogged | $this->thrownErrors);
+
+ if ($flush) {
+ foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
+ $type = $log[2]['exception'] instanceof \ErrorException ? $log[2]['exception']->getSeverity() : E_ERROR;
+ if (!isset($flush[$type])) {
+ $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
+ } elseif ($this->loggers[$type][0]) {
+ $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
+ }
+ }
+ }
+
+ return $prev;
+ }
+
+ /**
+ * Sets a user exception handler.
+ *
+ * @param callable $handler A handler that will be called on Exception
+ *
+ * @return callable|null The previous exception handler
+ */
+ public function setExceptionHandler(callable $handler = null)
+ {
+ $prev = $this->exceptionHandler;
+ $this->exceptionHandler = $handler;
+
+ return $prev;
+ }
+
+ /**
+ * Sets the PHP error levels that throw an exception when a PHP error occurs.
+ *
+ * @param int $levels A bit field of E_* constants for thrown errors
+ * @param bool $replace Replace or amend the previous value
+ *
+ * @return int The previous value
+ */
+ public function throwAt($levels, $replace = false)
+ {
+ $prev = $this->thrownErrors;
+ $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
+ if (!$replace) {
+ $this->thrownErrors |= $prev;
+ }
+ $this->reRegister($prev | $this->loggedErrors);
+
+ return $prev;
+ }
+
+ /**
+ * Sets the PHP error levels for which local variables are preserved.
+ *
+ * @param int $levels A bit field of E_* constants for scoped errors
+ * @param bool $replace Replace or amend the previous value
+ *
+ * @return int The previous value
+ */
+ public function scopeAt($levels, $replace = false)
+ {
+ $prev = $this->scopedErrors;
+ $this->scopedErrors = (int) $levels;
+ if (!$replace) {
+ $this->scopedErrors |= $prev;
+ }
+
+ return $prev;
+ }
+
+ /**
+ * Sets the PHP error levels for which the stack trace is preserved.
+ *
+ * @param int $levels A bit field of E_* constants for traced errors
+ * @param bool $replace Replace or amend the previous value
+ *
+ * @return int The previous value
+ */
+ public function traceAt($levels, $replace = false)
+ {
+ $prev = $this->tracedErrors;
+ $this->tracedErrors = (int) $levels;
+ if (!$replace) {
+ $this->tracedErrors |= $prev;
+ }
+
+ return $prev;
+ }
+
+ /**
+ * Sets the error levels where the @-operator is ignored.
+ *
+ * @param int $levels A bit field of E_* constants for screamed errors
+ * @param bool $replace Replace or amend the previous value
+ *
+ * @return int The previous value
+ */
+ public function screamAt($levels, $replace = false)
+ {
+ $prev = $this->screamedErrors;
+ $this->screamedErrors = (int) $levels;
+ if (!$replace) {
+ $this->screamedErrors |= $prev;
+ }
+
+ return $prev;
+ }
+
+ /**
+ * Re-registers as a PHP error handler if levels changed.
+ */
+ private function reRegister($prev)
+ {
+ if ($prev !== $this->thrownErrors | $this->loggedErrors) {
+ $handler = set_error_handler('var_dump');
+ $handler = is_array($handler) ? $handler[0] : null;
+ restore_error_handler();
+ if ($handler === $this) {
+ restore_error_handler();
+ if ($this->isRoot) {
+ set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
+ } else {
+ set_error_handler(array($this, 'handleError'));
+ }
+ }
+ }
+ }
+
+ /**
+ * Handles errors by filtering then logging them according to the configured bit fields.
+ *
+ * @param int $type One of the E_* constants
+ * @param string $message
+ * @param string $file
+ * @param int $line
+ *
+ * @return bool Returns false when no handling happens so that the PHP engine can handle the error itself
+ *
+ * @throws \ErrorException When $this->thrownErrors requests so
+ *
+ * @internal
+ */
+ public function handleError($type, $message, $file, $line)
+ {
+ // Level is the current error reporting level to manage silent error.
+ // Strong errors are not authorized to be silenced.
+ $level = error_reporting() | E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
+ $log = $this->loggedErrors & $type;
+ $throw = $this->thrownErrors & $type & $level;
+ $type &= $level | $this->screamedErrors;
+
+ if (!$type || (!$log && !$throw)) {
+ return $type && $log;
+ }
+ $scope = $this->scopedErrors & $type;
+
+ if (4 < $numArgs = func_num_args()) {
+ $context = $scope ? (func_get_arg(4) ?: array()) : array();
+ $backtrace = 5 < $numArgs ? func_get_arg(5) : null; // defined on HHVM
+ } else {
+ $context = array();
+ $backtrace = null;
+ }
+
+ if (isset($context['GLOBALS']) && $scope) {
+ $e = $context; // Whatever the signature of the method,
+ unset($e['GLOBALS'], $context); // $context is always a reference in 5.3
+ $context = $e;
+ }
+
+ if (null !== $backtrace && $type & E_ERROR) {
+ // E_ERROR fatal errors are triggered on HHVM when
+ // hhvm.error_handling.call_user_handler_on_fatals=1
+ // which is the way to get their backtrace.
+ $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
+
+ return true;
+ }
+
+ $logMessage = $this->levels[$type].': '.$message;
+
+ if (null !== self::$toStringException) {
+ $errorAsException = self::$toStringException;
+ self::$toStringException = null;
+ } elseif (!$throw && !($type & $level)) {
+ if (!isset(self::$silencedErrorCache[$id = $file.':'.$line])) {
+ $lightTrace = $this->tracedErrors & $type ? $this->cleanTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3), $type, $file, $line, false) : array();
+ $errorAsException = new SilencedErrorContext($type, $file, $line, $lightTrace);
+ } elseif (isset(self::$silencedErrorCache[$id][$message])) {
+ $lightTrace = null;
+ $errorAsException = self::$silencedErrorCache[$id][$message];
+ ++$errorAsException->count;
+ } else {
+ $lightTrace = array();
+ $errorAsException = null;
+ }
+
+ if (100 < ++self::$silencedErrorCount) {
+ self::$silencedErrorCache = $lightTrace = array();
+ self::$silencedErrorCount = 1;
+ }
+ if ($errorAsException) {
+ self::$silencedErrorCache[$id][$message] = $errorAsException;
+ }
+ if (null === $lightTrace) {
+ return;
+ }
+ } else {
+ if ($scope) {
+ $errorAsException = new ContextErrorException($logMessage, 0, $type, $file, $line, $context);
+ } else {
+ $errorAsException = new \ErrorException($logMessage, 0, $type, $file, $line);
+ }
+
+ // Clean the trace by removing function arguments and the first frames added by the error handler itself.
+ if ($throw || $this->tracedErrors & $type) {
+ $backtrace = $backtrace ?: $errorAsException->getTrace();
+ $lightTrace = $this->cleanTrace($backtrace, $type, $file, $line, $throw);
+ $this->traceReflector->setValue($errorAsException, $lightTrace);
+ } else {
+ $this->traceReflector->setValue($errorAsException, array());
+ }
+ }
+
+ if ($throw) {
+ if (E_USER_ERROR & $type) {
+ for ($i = 1; isset($backtrace[$i]); ++$i) {
+ if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
+ && '__toString' === $backtrace[$i]['function']
+ && '->' === $backtrace[$i]['type']
+ && !isset($backtrace[$i - 1]['class'])
+ && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
+ ) {
+ // Here, we know trigger_error() has been called from __toString().
+ // HHVM is fine with throwing from __toString() but PHP triggers a fatal error instead.
+ // A small convention allows working around the limitation:
+ // given a caught $e exception in __toString(), quitting the method with
+ // `return trigger_error($e, E_USER_ERROR);` allows this error handler
+ // to make $e get through the __toString() barrier.
+
+ foreach ($context as $e) {
+ if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
+ if (1 === $i) {
+ // On HHVM
+ $errorAsException = $e;
+ break;
+ }
+ self::$toStringException = $e;
+
+ return true;
+ }
+ }
+
+ if (1 < $i) {
+ // On PHP (not on HHVM), display the original error message instead of the default one.
+ $this->handleException($errorAsException);
+
+ // Stop the process by giving back the error to the native handler.
+ return false;
+ }
+ }
+ }
+ }
+
+ throw $errorAsException;
+ }
+
+ if ($this->isRecursive) {
+ $log = 0;
+ } elseif (self::$stackedErrorLevels) {
+ self::$stackedErrors[] = array(
+ $this->loggers[$type][0],
+ ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG,
+ $logMessage,
+ $errorAsException ? array('exception' => $errorAsException) : array(),
+ );
+ } else {
+ try {
+ $this->isRecursive = true;
+ $level = ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG;
+ $this->loggers[$type][0]->log($level, $logMessage, $errorAsException ? array('exception' => $errorAsException) : array());
+ } finally {
+ $this->isRecursive = false;
+ }
+ }
+
+ return $type && $log;
+ }
+
+ /**
+ * Handles an exception by logging then forwarding it to another handler.
+ *
+ * @param \Exception|\Throwable $exception An exception to handle
+ * @param array $error An array as returned by error_get_last()
+ *
+ * @internal
+ */
+ public function handleException($exception, array $error = null)
+ {
+ if (null === $error) {
+ self::$exitCode = 255;
+ }
+ if (!$exception instanceof \Exception) {
+ $exception = new FatalThrowableError($exception);
+ }
+ $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
+ $handlerException = null;
+
+ if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
+ if ($exception instanceof FatalErrorException) {
+ if ($exception instanceof FatalThrowableError) {
+ $error = array(
+ 'type' => $type,
+ 'message' => $message = $exception->getMessage(),
+ 'file' => $exception->getFile(),
+ 'line' => $exception->getLine(),
+ );
+ } else {
+ $message = 'Fatal '.$exception->getMessage();
+ }
+ } elseif ($exception instanceof \ErrorException) {
+ $message = 'Uncaught '.$exception->getMessage();
+ } else {
+ $message = 'Uncaught Exception: '.$exception->getMessage();
+ }
+ }
+ if ($this->loggedErrors & $type) {
+ try {
+ $this->loggers[$type][0]->log($this->loggers[$type][1], $message, array('exception' => $exception));
+ } catch (\Exception $handlerException) {
+ } catch (\Throwable $handlerException) {
+ }
+ }
+ if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
+ foreach ($this->getFatalErrorHandlers() as $handler) {
+ if ($e = $handler->handleError($error, $exception)) {
+ $exception = $e;
+ break;
+ }
+ }
+ }
+ try {
+ if (null !== $this->exceptionHandler) {
+ return \call_user_func($this->exceptionHandler, $exception);
+ }
+ $handlerException = $handlerException ?: $exception;
+ } catch (\Exception $handlerException) {
+ } catch (\Throwable $handlerException) {
+ }
+ $this->exceptionHandler = null;
+ if ($exception === $handlerException) {
+ self::$reservedMemory = null; // Disable the fatal error handler
+ throw $exception; // Give back $exception to the native handler
+ }
+ $this->handleException($handlerException);
+ }
+
+ /**
+ * Shutdown registered function for handling PHP fatal errors.
+ *
+ * @param array $error An array as returned by error_get_last()
+ *
+ * @internal
+ */
+ public static function handleFatalError(array $error = null)
+ {
+ if (null === self::$reservedMemory) {
+ return;
+ }
+
+ $handler = self::$reservedMemory = null;
+ $handlers = array();
+
+ while (!is_array($handler) || !$handler[0] instanceof self) {
+ $handler = set_exception_handler('var_dump');
+ restore_exception_handler();
+
+ if (!$handler) {
+ break;
+ }
+ restore_exception_handler();
+ array_unshift($handlers, $handler);
+ }
+ foreach ($handlers as $h) {
+ set_exception_handler($h);
+ }
+ if (!$handler) {
+ return;
+ }
+ if ($handler !== $h) {
+ $handler[0]->setExceptionHandler($h);
+ }
+ $handler = $handler[0];
+ $handlers = array();
+
+ if ($exit = null === $error) {
+ $error = error_get_last();
+ }
+
+ try {
+ while (self::$stackedErrorLevels) {
+ static::unstackErrors();
+ }
+ } catch (\Exception $exception) {
+ // Handled below
+ } catch (\Throwable $exception) {
+ // Handled below
+ }
+
+ if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
+ // Let's not throw anymore but keep logging
+ $handler->throwAt(0, true);
+ $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
+
+ if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
+ $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
+ } else {
+ $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
+ }
+ }
+
+ try {
+ if (isset($exception)) {
+ self::$exitCode = 255;
+ $handler->handleException($exception, $error);
+ }
+ } catch (FatalErrorException $e) {
+ // Ignore this re-throw
+ }
+
+ if ($exit && self::$exitCode) {
+ $exitCode = self::$exitCode;
+ register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
+ }
+ }
+
+ /**
+ * Configures the error handler for delayed handling.
+ * Ensures also that non-catchable fatal errors are never silenced.
+ *
+ * As shown by http://bugs.php.net/42098 and http://bugs.php.net/60724
+ * PHP has a compile stage where it behaves unusually. To workaround it,
+ * we plug an error handler that only stacks errors for later.
+ *
+ * The most important feature of this is to prevent
+ * autoloading until unstackErrors() is called.
+ *
+ * @deprecated since version 3.4, to be removed in 4.0.
+ */
+ public static function stackErrors()
+ {
+ @trigger_error('Support for stacking errors is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED);
+
+ self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
+ }
+
+ /**
+ * Unstacks stacked errors and forwards to the logger.
+ *
+ * @deprecated since version 3.4, to be removed in 4.0.
+ */
+ public static function unstackErrors()
+ {
+ @trigger_error('Support for unstacking errors is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED);
+
+ $level = array_pop(self::$stackedErrorLevels);
+
+ if (null !== $level) {
+ $errorReportingLevel = error_reporting($level);
+ if ($errorReportingLevel !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
+ // If the user changed the error level, do not overwrite it
+ error_reporting($errorReportingLevel);
+ }
+ }
+
+ if (empty(self::$stackedErrorLevels)) {
+ $errors = self::$stackedErrors;
+ self::$stackedErrors = array();
+
+ foreach ($errors as $error) {
+ $error[0]->log($error[1], $error[2], $error[3]);
+ }
+ }
+ }
+
+ /**
+ * Gets the fatal error handlers.
+ *
+ * Override this method if you want to define more fatal error handlers.
+ *
+ * @return FatalErrorHandlerInterface[] An array of FatalErrorHandlerInterface
+ */
+ protected function getFatalErrorHandlers()
+ {
+ return array(
+ new UndefinedFunctionFatalErrorHandler(),
+ new UndefinedMethodFatalErrorHandler(),
+ new ClassNotFoundFatalErrorHandler(),
+ );
+ }
+
+ private function cleanTrace($backtrace, $type, $file, $line, $throw)
+ {
+ $lightTrace = $backtrace;
+
+ for ($i = 0; isset($backtrace[$i]); ++$i) {
+ if (isset($backtrace[$i]['file'], $backtrace[$i]['line']) && $backtrace[$i]['line'] === $line && $backtrace[$i]['file'] === $file) {
+ $lightTrace = array_slice($lightTrace, 1 + $i);
+ break;
+ }
+ }
+ if (!($throw || $this->scopedErrors & $type)) {
+ for ($i = 0; isset($lightTrace[$i]); ++$i) {
+ unset($lightTrace[$i]['args'], $lightTrace[$i]['object']);
+ }
+ }
+
+ return $lightTrace;
+ }
+}
diff --git a/vendor/symfony/debug/Exception/ClassNotFoundException.php b/vendor/symfony/debug/Exception/ClassNotFoundException.php
new file mode 100644
index 000000000..b91bf4663
--- /dev/null
+++ b/vendor/symfony/debug/Exception/ClassNotFoundException.php
@@ -0,0 +1,33 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Debug\Exception;
+
+/**
+ * Class (or Trait or Interface) Not Found Exception.
+ *
+ * @author Konstanton Myakshin
+ */
+class ClassNotFoundException extends FatalErrorException
+{
+ public function __construct($message, \ErrorException $previous)
+ {
+ parent::__construct(
+ $message,
+ $previous->getCode(),
+ $previous->getSeverity(),
+ $previous->getFile(),
+ $previous->getLine(),
+ $previous->getPrevious()
+ );
+ $this->setTrace($previous->getTrace());
+ }
+}
diff --git a/vendor/symfony/debug/Exception/ContextErrorException.php b/vendor/symfony/debug/Exception/ContextErrorException.php
new file mode 100644
index 000000000..6561d4df3
--- /dev/null
+++ b/vendor/symfony/debug/Exception/ContextErrorException.php
@@ -0,0 +1,40 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Debug\Exception;
+
+/**
+ * Error Exception with Variable Context.
+ *
+ * @author Christian Sciberras
+ *
+ * @deprecated since version 3.3. Instead, \ErrorException will be used directly in 4.0.
+ */
+class ContextErrorException extends \ErrorException
+{
+ private $context = array();
+
+ public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
+ {
+ parent::__construct($message, $code, $severity, $filename, $lineno);
+ $this->context = $context;
+ }
+
+ /**
+ * @return array Array of variables that existed when the exception occurred
+ */
+ public function getContext()
+ {
+ @trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
+
+ return $this->context;
+ }
+}
diff --git a/vendor/symfony/debug/Exception/FatalErrorException.php b/vendor/symfony/debug/Exception/FatalErrorException.php
new file mode 100644
index 000000000..f24a54e77
--- /dev/null
+++ b/vendor/symfony/debug/Exception/FatalErrorException.php
@@ -0,0 +1,82 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Debug\Exception;
+
+/**
+ * Fatal Error Exception.
+ *
+ * @author Konstanton Myakshin
+ */
+class FatalErrorException extends \ErrorException
+{
+ public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null)
+ {
+ parent::__construct($message, $code, $severity, $filename, $lineno);
+
+ if (null !== $trace) {
+ if (!$traceArgs) {
+ foreach ($trace as &$frame) {
+ unset($frame['args'], $frame['this'], $frame);
+ }
+ }
+
+ $this->setTrace($trace);
+ } elseif (null !== $traceOffset) {
+ if (function_exists('xdebug_get_function_stack')) {
+ $trace = xdebug_get_function_stack();
+ if (0 < $traceOffset) {
+ array_splice($trace, -$traceOffset);
+ }
+
+ foreach ($trace as &$frame) {
+ if (!isset($frame['type'])) {
+ // XDebug pre 2.1.1 doesn't currently set the call type key http://bugs.xdebug.org/view.php?id=695
+ if (isset($frame['class'])) {
+ $frame['type'] = '::';
+ }
+ } elseif ('dynamic' === $frame['type']) {
+ $frame['type'] = '->';
+ } elseif ('static' === $frame['type']) {
+ $frame['type'] = '::';
+ }
+
+ // XDebug also has a different name for the parameters array
+ if (!$traceArgs) {
+ unset($frame['params'], $frame['args']);
+ } elseif (isset($frame['params']) && !isset($frame['args'])) {
+ $frame['args'] = $frame['params'];
+ unset($frame['params']);
+ }
+ }
+
+ unset($frame);
+ $trace = array_reverse($trace);
+ } elseif (function_exists('symfony_debug_backtrace')) {
+ $trace = symfony_debug_backtrace();
+ if (0 < $traceOffset) {
+ array_splice($trace, 0, $traceOffset);
+ }
+ } else {
+ $trace = array();
+ }
+
+ $this->setTrace($trace);
+ }
+ }
+
+ protected function setTrace($trace)
+ {
+ $traceReflector = new \ReflectionProperty('Exception', 'trace');
+ $traceReflector->setAccessible(true);
+ $traceReflector->setValue($this, $trace);
+ }
+}
diff --git a/vendor/symfony/debug/Exception/FatalThrowableError.php b/vendor/symfony/debug/Exception/FatalThrowableError.php
new file mode 100644
index 000000000..34f43b17b
--- /dev/null
+++ b/vendor/symfony/debug/Exception/FatalThrowableError.php
@@ -0,0 +1,44 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Debug\Exception;
+
+/**
+ * Fatal Throwable Error.
+ *
+ * @author Nicolas Grekas
+ */
+class FatalThrowableError extends FatalErrorException
+{
+ public function __construct(\Throwable $e)
+ {
+ if ($e instanceof \ParseError) {
+ $message = 'Parse error: '.$e->getMessage();
+ $severity = E_PARSE;
+ } elseif ($e instanceof \TypeError) {
+ $message = 'Type error: '.$e->getMessage();
+ $severity = E_RECOVERABLE_ERROR;
+ } else {
+ $message = $e->getMessage();
+ $severity = E_ERROR;
+ }
+
+ \ErrorException::__construct(
+ $message,
+ $e->getCode(),
+ $severity,
+ $e->getFile(),
+ $e->getLine()
+ );
+
+ $this->setTrace($e->getTrace());
+ }
+}
diff --git a/vendor/symfony/debug/Exception/FlattenException.php b/vendor/symfony/debug/Exception/FlattenException.php
new file mode 100644
index 000000000..24679dcaa
--- /dev/null
+++ b/vendor/symfony/debug/Exception/FlattenException.php
@@ -0,0 +1,263 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Debug\Exception;
+
+use Symfony\Component\HttpFoundation\Exception\RequestExceptionInterface;
+use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
+
+/**
+ * FlattenException wraps a PHP Exception to be able to serialize it.
+ *
+ * Basically, this class removes all objects from the trace.
+ *
+ * @author Fabien Potencier
+ */
+class FlattenException
+{
+ private $message;
+ private $code;
+ private $previous;
+ private $trace;
+ private $class;
+ private $statusCode;
+ private $headers;
+ private $file;
+ private $line;
+
+ public static function create(\Exception $exception, $statusCode = null, array $headers = array())
+ {
+ $e = new static();
+ $e->setMessage($exception->getMessage());
+ $e->setCode($exception->getCode());
+
+ if ($exception instanceof HttpExceptionInterface) {
+ $statusCode = $exception->getStatusCode();
+ $headers = array_merge($headers, $exception->getHeaders());
+ } elseif ($exception instanceof RequestExceptionInterface) {
+ $statusCode = 400;
+ }
+
+ if (null === $statusCode) {
+ $statusCode = 500;
+ }
+
+ $e->setStatusCode($statusCode);
+ $e->setHeaders($headers);
+ $e->setTraceFromException($exception);
+ $e->setClass(get_class($exception));
+ $e->setFile($exception->getFile());
+ $e->setLine($exception->getLine());
+
+ $previous = $exception->getPrevious();
+
+ if ($previous instanceof \Exception) {
+ $e->setPrevious(static::create($previous));
+ } elseif ($previous instanceof \Throwable) {
+ $e->setPrevious(static::create(new FatalThrowableError($previous)));
+ }
+
+ return $e;
+ }
+
+ public function toArray()
+ {
+ $exceptions = array();
+ foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
+ $exceptions[] = array(
+ 'message' => $exception->getMessage(),
+ 'class' => $exception->getClass(),
+ 'trace' => $exception->getTrace(),
+ );
+ }
+
+ return $exceptions;
+ }
+
+ public function getStatusCode()
+ {
+ return $this->statusCode;
+ }
+
+ public function setStatusCode($code)
+ {
+ $this->statusCode = $code;
+ }
+
+ public function getHeaders()
+ {
+ return $this->headers;
+ }
+
+ public function setHeaders(array $headers)
+ {
+ $this->headers = $headers;
+ }
+
+ public function getClass()
+ {
+ return $this->class;
+ }
+
+ public function setClass($class)
+ {
+ $this->class = $class;
+ }
+
+ public function getFile()
+ {
+ return $this->file;
+ }
+
+ public function setFile($file)
+ {
+ $this->file = $file;
+ }
+
+ public function getLine()
+ {
+ return $this->line;
+ }
+
+ public function setLine($line)
+ {
+ $this->line = $line;
+ }
+
+ public function getMessage()
+ {
+ return $this->message;
+ }
+
+ public function setMessage($message)
+ {
+ $this->message = $message;
+ }
+
+ public function getCode()
+ {
+ return $this->code;
+ }
+
+ public function setCode($code)
+ {
+ $this->code = $code;
+ }
+
+ public function getPrevious()
+ {
+ return $this->previous;
+ }
+
+ public function setPrevious(FlattenException $previous)
+ {
+ $this->previous = $previous;
+ }
+
+ public function getAllPrevious()
+ {
+ $exceptions = array();
+ $e = $this;
+ while ($e = $e->getPrevious()) {
+ $exceptions[] = $e;
+ }
+
+ return $exceptions;
+ }
+
+ public function getTrace()
+ {
+ return $this->trace;
+ }
+
+ public function setTraceFromException(\Exception $exception)
+ {
+ $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
+ }
+
+ public function setTrace($trace, $file, $line)
+ {
+ $this->trace = array();
+ $this->trace[] = array(
+ 'namespace' => '',
+ 'short_class' => '',
+ 'class' => '',
+ 'type' => '',
+ 'function' => '',
+ 'file' => $file,
+ 'line' => $line,
+ 'args' => array(),
+ );
+ foreach ($trace as $entry) {
+ $class = '';
+ $namespace = '';
+ if (isset($entry['class'])) {
+ $parts = explode('\\', $entry['class']);
+ $class = array_pop($parts);
+ $namespace = implode('\\', $parts);
+ }
+
+ $this->trace[] = array(
+ 'namespace' => $namespace,
+ 'short_class' => $class,
+ 'class' => isset($entry['class']) ? $entry['class'] : '',
+ 'type' => isset($entry['type']) ? $entry['type'] : '',
+ 'function' => isset($entry['function']) ? $entry['function'] : null,
+ 'file' => isset($entry['file']) ? $entry['file'] : null,
+ 'line' => isset($entry['line']) ? $entry['line'] : null,
+ 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
+ );
+ }
+ }
+
+ private function flattenArgs($args, $level = 0, &$count = 0)
+ {
+ $result = array();
+ foreach ($args as $key => $value) {
+ if (++$count > 1e4) {
+ return array('array', '*SKIPPED over 10000 entries*');
+ }
+ if ($value instanceof \__PHP_Incomplete_Class) {
+ // is_object() returns false on PHP<=7.1
+ $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
+ } elseif (is_object($value)) {
+ $result[$key] = array('object', get_class($value));
+ } elseif (is_array($value)) {
+ if ($level > 10) {
+ $result[$key] = array('array', '*DEEP NESTED ARRAY*');
+ } else {
+ $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
+ }
+ } elseif (null === $value) {
+ $result[$key] = array('null', null);
+ } elseif (is_bool($value)) {
+ $result[$key] = array('boolean', $value);
+ } elseif (is_int($value)) {
+ $result[$key] = array('integer', $value);
+ } elseif (is_float($value)) {
+ $result[$key] = array('float', $value);
+ } elseif (is_resource($value)) {
+ $result[$key] = array('resource', get_resource_type($value));
+ } else {
+ $result[$key] = array('string', (string) $value);
+ }
+ }
+
+ return $result;
+ }
+
+ private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
+ {
+ $array = new \ArrayObject($value);
+
+ return $array['__PHP_Incomplete_Class_Name'];
+ }
+}
diff --git a/vendor/symfony/debug/Exception/OutOfMemoryException.php b/vendor/symfony/debug/Exception/OutOfMemoryException.php
new file mode 100644
index 000000000..fec197983
--- /dev/null
+++ b/vendor/symfony/debug/Exception/OutOfMemoryException.php
@@ -0,0 +1,21 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Debug\Exception;
+
+/**
+ * Out of memory exception.
+ *
+ * @author Nicolas Grekas
+ */
+class OutOfMemoryException extends FatalErrorException
+{
+}
diff --git a/vendor/symfony/debug/Exception/SilencedErrorContext.php b/vendor/symfony/debug/Exception/SilencedErrorContext.php
new file mode 100644
index 000000000..4be83491b
--- /dev/null
+++ b/vendor/symfony/debug/Exception/SilencedErrorContext.php
@@ -0,0 +1,67 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Debug\Exception;
+
+/**
+ * Data Object that represents a Silenced Error.
+ *
+ * @author Grégoire Pineau
+ */
+class SilencedErrorContext implements \JsonSerializable
+{
+ public $count = 1;
+
+ private $severity;
+ private $file;
+ private $line;
+ private $trace;
+
+ public function __construct($severity, $file, $line, array $trace = array(), $count = 1)
+ {
+ $this->severity = $severity;
+ $this->file = $file;
+ $this->line = $line;
+ $this->trace = $trace;
+ $this->count = $count;
+ }
+
+ public function getSeverity()
+ {
+ return $this->severity;
+ }
+
+ public function getFile()
+ {
+ return $this->file;
+ }
+
+ public function getLine()
+ {
+ return $this->line;
+ }
+
+ public function getTrace()
+ {
+ return $this->trace;
+ }
+
+ public function JsonSerialize()
+ {
+ return array(
+ 'severity' => $this->severity,
+ 'file' => $this->file,
+ 'line' => $this->line,
+ 'trace' => $this->trace,
+ 'count' => $this->count,
+ );
+ }
+}
diff --git a/vendor/symfony/debug/Exception/UndefinedFunctionException.php b/vendor/symfony/debug/Exception/UndefinedFunctionException.php
new file mode 100644
index 000000000..a66ae2a38
--- /dev/null
+++ b/vendor/symfony/debug/Exception/UndefinedFunctionException.php
@@ -0,0 +1,33 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Debug\Exception;
+
+/**
+ * Undefined Function Exception.
+ *
+ * @author Konstanton Myakshin