Handle the PHP shutdown event.

@return  void
554348
public function handleShutdown()
	{
		$error = error_get_last();

		// If an error has occurred that has not been displayed, we will create a fatal
		// error exception instance and pass it into the regular exception handling
		// code so it can be displayed back out to the developer for information.
		if (!is_null($error))
		{
			extract($error);

			if (!in_array($type, array(E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE)))
			{
				return;
			}

			$this->handleException(new FatalError($message, $type, 0, $file, $line));
		}
	}
1164521
public function onShutdown()
    {
        $error = error_get_last();
        if ($error === null) {
            return;
        }
        if (($error['type'] & error_reporting()) === 0) {
            return;
        }
        if ($this->lastError !== null &&
            $error['message'] === $this->lastError['message'] &&
            $error['file'] === $this->lastError['file'] &&
            $error['line'] === $this->lastError['line']) {
            return;
        }
        $trace = [[
            'file' => $error['file'],
            'line' => $error['line'],
        ]];
        $exc = new Errors\Fatal($error['message'], $trace);
        $this->notifier->notify($exc);
    }
945821
public function shutdown()
    {
        // check if there was a fatal error caused shutdown
        if ($lastError = error_get_last()) {
            // initialize type + message
            $type = 0;
            $message = '';
            // extract the last error values
            extract($lastError);
            // query whether we've a fatal/user error
            if ($type === E_ERROR || $type === E_USER_ERROR) {
                error_log($message);
            }
        }
    }
1222406
public function shutdownFunction() {
		if(($e=error_get_last()) && $e !== static::$errorAtStart) {
			foreach($this->ignoreDirs as $dir) {
				if(strpos($e['file'], $dir) === 0)
					return;
			}

			while(ob_get_level()) ob_end_clean();
			$exceptionHandler = set_exception_handler(function() {});
			restore_exception_handler();
			$exception = new FatalErrorException($e['message'], $e['type'], 0, $e['file'], $e['line']);
			call_user_func_array($exceptionHandler, [$exception]);
		}
	}
405424
public function shutdownHandler()
    {
        $lastError = error_get_last();

        if (is_array($lastError)) {
            $this->errorHandler(
                $lastError[ 'type' ],
                $lastError[ 'message' ],
                $lastError[ 'file' ],
                $lastError[ 'line' ]
            );
        }
    }
388697
public function shutdownFunction()
    {
        $this->reservedMemory = null;
        
        $err = $this->errorGetLast();
        $unhandled = E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR;
        
        if (empty($err) || !($err['type'] & $unhandled)) {
            return;
        }
        
        $error = new \ErrorException($err['message'], 0, $err['type'], $err['file'], $err['line']);
        
        if ($err['type'] & $this->getLoggedErrorTypes()) {
            $this->log($error);
        }
        
        $this->callOnFatalError($error);
    }
732304
public function shutdownHandler()
    {
        $error = error_get_last();

        if(!is_null($error)) {
            $this->exceptionHandler(new FatalErrorException($error['message'], $error['type'], 0, $error['file'], $error['line'], 0));
        }
    }
941585
public function handleShutdown()
    {
        // If we reached this step, we are in shutdown handler.
        // An exception thrown in a shutdown handler will not be propagated
        // to the exception handler. Pass that information along.
        $this->canThrowExceptions = false;

        $error = error_get_last();
        if ($error && Misc::isLevelFatal($error['type'])) {
            // If there was a fatal error,
            // it was not handled in handleError yet.
            $this->handleError(
                $error['type'],
                $error['message'],
                $error['file'],
                $error['line']
            );
        }
    }
73455
public static function handle_shutdown() {
		$isFatal = false;
		$error = error_get_last();
		if($error !== NULL && $error['type'] === E_ERROR) {
			$isFatal = true;
			self::handle_error($error['type'], $error['message'], $error['file'], $error['line']);
		}

		if(!count(self::$log))
			return false;

		$filament = self::getFilament();

		curl_get_contents(Configuration::get("filament.location"), array(
			"version"     => 2,
			"key"         => Configuration::get("filament.key"),
			"data"        => @json_encode($filament),
			"error_count" => self::$error_count
		), defined('CURLOPT_CONNECTTIMEOUT_MS') ? array(
			CURLOPT_NOSIGNAL => true,
			CURLOPT_CONNECTTIMEOUT_MS => 250
		) : array(
			CURLOPT_CONNECTTIMEOUT => 1
		));

		if($isFatal) {
			Request::setResponseCode("exception", "fatal server error");
			$response = array(
				"data"           => $data,
				"response"       => Request::getResponseCode(),
				"render_actions" => array()
			);

			if(Request::isAjax()) {
				http_response_code(200);
				if(Kernel::getEnvironment() != "production")
					$response["filament"] = $filament;
				json_echo($response);
			} else {
				echo "<h1>Fatal Error</h1>";
				if(Kernel::getEnvironment() != "production")
					echo "<pre>" . var_export(self::$log, true) . "</pre>";
			}
		}
	}
1014417
public function shutdown()
    {
        if (!empty($this->ch)) {
            curl_close($this->ch);
            $this->ch = null;
        }
    }
1237500
public static function shutdown_handler($errors = false, $handled = false)
    {
        if ($handled) {
            self::flush();
        }

        if ($errors === true && ($error = error_get_last()) && !$handled) {
            self::error_handler($error["type"], $error["message"], $error["file"], $error["line"]);
        }

        if (!$handled) {
            self::flush();
        }

        if (session_id() != '') {
            session_write_close();
        }

        exit;
    }
713089
public function onShutdown()
    {
        try {
            $e = error_get_last();
            if (in_array($e['type'], [
                E_ERROR,
                E_PARSE,
                E_CORE_ERROR,
                E_COMPILE_ERROR,
                E_USER_ERROR,
                E_RECOVERABLE_ERROR
            ]))
            {
                Log::error($e['message'], [
                    'trace' => [],
                    'errorFile'  =>  $e['file'],
                    'errorLine'  =>  $e['line'],
                ]);
            }
            $logger = App::getBean('Logger');
            $logger->save();
        } catch(\Throwable $th) {
            echo $th->getMessage(), ' ', $th->getFile(), ':', $th->getLine(), PHP_EOL;
        }
    }
691510
public function handleShutdown()
	{
		if ( !is_null( $error = error_get_last() ) && in_array( $error['type'], [
				E_ERROR,
				E_CORE_ERROR,
				E_COMPILE_ERROR,
				E_PARSE
			] )
		)
		{
			$this->handleException( new FatalErrorException( $error['message'], $error['type'], 0, $error['file'], $error['line'], 0 ) );
		}
	}
895252
public function shutdownHandler()
    {
        $lastError = error_get_last();

        if (is_array($lastError)) {
            $this->errorHandler(
                $lastError[ 'type' ],
                $lastError[ 'message' ],
                $lastError[ 'file' ],
                $lastError[ 'line' ]
            );
        }

        // Execute shutdown service
        if(services()->has('shutdown')) {
            shutdown()->execute();
        }
    }
1090120
protected function _shutdown()
    {
        $this->controller->dispatchEvent('Controller.shutdown');
        $dispatcher = DispatcherFactory::create();
        $eventManager = $dispatcher->getEventManager();
        foreach ($dispatcher->filters() as $filter) {
            $eventManager->on($filter);
        }
        $args = [
            'request' => $this->controller->request,
            'response' => $this->controller->response
        ];
        $result = $dispatcher->dispatchEvent('Dispatcher.afterDispatch', $args);

        return $result->getData('response');
    }
1219450
public function handleShutdown()
    {
        $error = $this->getLastError();

        // Ignore core warnings and errors.
        if ($error && !($error['type'] & (E_CORE_WARNING | E_CORE_ERROR))) {
            $handler = $this->whoopsShutdownHandler;
            $handler();
        }
    }
691815
public static function ShutdownHandler () {
		$error = error_get_last();
		if (isset($error['type'])) static::Exception($error);
		if (!self::isHtmlResponse() || count(self::$dumps) === 0) return;
		list($dumps, $lastDump) = self::formatDebugDumps();
		echo str_replace(
			['%mvccoreDumps%', '"%mvccoreInitArgs%"'],
			[$dumps, ($lastDump ? '!0' : '!1') . ',' . count(self::$dumps)],
			file_get_contents(__DIR__.'/debug.html')
		);
	}