Handle the PHP shutdown event.

@param Logger     $logger
@param array|null $error
@param bool       $exit
192886
public static function shutdown(Logger $logger, $error, $exit = true)
    {
        // if a fatal error occurred
        if (!is_null($error)) {
            static::exception(new \ErrorException($error['message'], $error['type'], 0, $error['file'], $error['line']),
                $logger, $exit);
        }
    }
1160192
public static function shutdown()
    {
        if (!is_null($error = error_get_last()) && self::isFatal($error['type'])) {
            self::exception(new Exception(
                $error['type'], $error['message'], $error['file'], $error['line']
            ));
        }

        // TODO 写入日志
    }
524444
private function log_exit( $response, $code ) {
		$json_encode_flags = 128 | 64;

		error_log( json_encode( $response, $json_encode_flags ) );

		/**
		 * Action hook after processing REST process.
		 *
		 * @since 8.6.0
		 *
		 * @param array $response
		 * @param int   $code     HTTP response.
		 */
		do_action( 'github_updater_post_rest_process_request', $response, $code );

		unset( $response['success'] );
		if ( 200 === $code ) {
			wp_die( wp_send_json_success( $response, $code ) );
		} else {
			wp_die( wp_send_json_error( $response, $code ) );
		}
	}
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')
		);
	}
944657
public static function shutdownHandler($type = E_ERROR)
    {
//echo __METHOD__;
        $error = error_get_last();
        if ($error["type"] & $type) {
            self::errorHandler( $error["type"], $error["message"], $error["file"], $error["line"] );
        }
    }
206178
public static function shutdownError()
    {
        // Load last error if thrown
        $errfile = 'Unknown file';
        $errstr = 'shutdown';
        $errno = E_CORE_ERROR;
        $errline = 0;

        $error = error_get_last();
        if ($error !== null) {
            $errno = $error['type'];
            $errfile = $error['file'];
            $errline = $error['line'];
            $errstr = $error['message'];

            // Log it!
            $thisType = self::getType($errno);
            Factory::getInstance()->output->set_output('');
            self::errorHandler($errno, $errstr, $errfile, $errline);

            if ($thisType == 'ERROR')
            {
               self::http_error('500'); 
            }
        }
    }
144706
public function shutdown($message = null, $code = null)
    {
        if (!is_null($message)) {
            $this->shutdownMessage = $message;
        }
        if (!is_null($code)) {
            $this->shutdownCode = $code;
        }
        $this->shutdown = true;
        return true;
    }
1125684
private function handleCurlError($error, $errorNumber, $verbose): void
    {
        if (!$error) {
            return;
        }

        $errorMessage = "\ncURL transport error: $errorNumber - $error";

        $transportException = new TransportException($errorMessage);

        rewind($verbose);

        $verboseLog = stream_get_contents($verbose);

        if ($verboseLog !== false) {
            $verboseLog = htmlspecialchars($verboseLog);

            $transportException->setData($verboseLog);
        }

        throw $transportException;
    }
1104114
def exit_on_error(self):
        """"""
        if self.exit_code:
            if self.errmsg is not None:
                logger.show("Exiting due to " + self.errmsg + ".")
                self.errmsg = None
            if self.using_jobs:
                kill_children()
            sys.exit(self.exit_code)
828472
public function stop($status = 0, $message = null) {
		if ($message) {
			($status == 0) ? $this->out($message) : $this->error($message);
		}
		exit($status);
	}
684110
public function end($exitCode = 0, $exit = true)
    {
        if ($this->hasEventHandler('endRequest')) {
            $this->onEndRequest(new Event($this));
        }
        if ($exit) {
            exit($exitCode);
        }
    }
642654
public static function shutdownHandler()
    {
        if ( ! ($error = error_get_last())) {
            return;
        }

        self::exceptionHandler(
            new \ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line'])
        );
    }
245487
public function executeListener($signal, $exit = true)
    {
        $return = null;

        if (isset($this->listeners[$signal])) {
            $return = call_user_func_array($this->listeners[$signal], [$signal]);
        }

        if (true === $exit) {
            // exit the application
            posix_kill(posix_getpid(), SIGKILL);
        }

        return $return;
    }
1216562
public function __shutdown(\swoole\Server $server) {
        $path = $this->options['enable_pid'];
        file_exists($path) and unlink($path);

        if(method_exists($this->callback,'shutdown')) {
            $this->callback->shutdown($server);
        }
    }
1165786
public static function shutdown()
    {
        $last_error = error_get_last();

        if (!is_null($last_error) && $last_error['type'] === E_ERROR) {
            $code = $last_error['type'];
            $message = $last_error['message'];
            $file = $last_error['file'];
            $line = $last_error['line'];

            try {
                // Log the error message
                if (self::$_Log instanceof Log) {
                    self::$_Log->pushToLog(sprintf(
                        '%s %s: %s%s%s',
                        __CLASS__,
                        $code,
                        $message,
                        ($line ? " on line $line" : null),
                        ($file ? " of file $file" : null)
                    ), $code, true);
                }

                ob_clean();

                // Display the error message
                echo self::renderHtml(
                    'fatalerror.fatal',
                    'Fatal Error',
                    $message,
                    $file,
                    $line
                );
            } catch (Exception $e) {
                echo "<pre>";
                echo 'A severe error occurred whilst trying to handle an exception, check the Symphony log for more details' . PHP_EOL;
                echo $e->getMessage() . ' on ' . $e->getLine() . ' of file ' . $e->getFile() . PHP_EOL;
            }
        }
    }
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;
    }
380475
public static void logAndExit(ExitLogger logger, int status) {
        logBeforeExit(logger);
        getExiter().exit(status);
        // If we get here, the exiter didn't really exit. So we
        // must be embedded or something, or perhaps in a test case
        // Reset the logged flag so we can log again the next time
        // someone "exits"
        logged.set(false);
    }