The shutdown callback.

It gets called when PHP is shutting down. It will render
out kreXX output, to guarantee minimal interference with
the hosting CMS.
330055
public function shutdownCallback()
    {
        // Output our chunks.
        // Every output is split into 4 chunk strings (header, messages,
        // data, footer).
        foreach ($this->chunkStrings as $chunkString) {
            // Send it to the browser.
            $this->pool->chunks->sendDechunkedToBrowser($chunkString);
        }
    }
234258
public static function shutdownHandler()
    {
        if ($err = error_get_last()) {
            switch ($err['type']) {
                case E_ERROR:
                case E_PARSE:
                case E_COMPILE_ERROR:
                case E_CORE_ERROR:
                    $service = self::$psrLogger
                        ->getMetadataProvider()
                        ->serviceId();
                    $version = self::$psrLogger
                        ->getMetadataProvider()
                        ->versionId();
                    $message = sprintf(
                        '%s: %s in %s on line %d',
                        self::getErrorPrefix($err['type']),
                        $err['message'],
                        $err['file'],
                        $err['line']
                    );
                    $context = [
                        'context' => [
                            'reportLocation' => [
                                'filePath' => $err['file'],
                                'lineNumber' => $err['line'],
                                'functionName' =>
                                    self::getFunctionNameForReport(),
                            ]
                        ],
                        'serviceContext' => [
                            'service' => $service,
                            'version' => $version
                        ]
                    ];
                    if (self::$psrLogger) {
                        self::$psrLogger->log(
                            self::getErrorLevelString($err['type']),
                            $message,
                            $context
                        );
                    }
                    break;
            }
        }
    }
232118
final public function shutdown() : void
    {
        $this->__call('shutdown');
        Master::wait($this->backend->process()->pid ?? -2);
    }
808148
public function shutdownOutput()
    {
        if (@socket_shutdown($this->socket, 1) === false) {
            $this->throwSocketError();
        }
        $this->out = null;
    }
603288
public function handleShutdown()
	{
		if (!$this->shutdownHandlerRegistered)
		{
			return;
		}

		$error = error_get_last();
		if ($error && Severity::fromPhpErrorNo($error['type']) >= $this->minSeverityOnShutdown)
		{
			$this->handleError(
				$error['type'],
				$error['message'],
				$error['file'],
				$error['line']
			);
		}
	}
816543
public function unregisterShutdownFunction($callback)
    {
        if (($k = array_search($callback, $this->shutdownFuncs)) !== false) {
            unset($this->shutdownFuncs[$k]);
        }
    }
1253499
def on_server_shutdown(self):
        """"""
        if not self._container:
            return
        self._container.stop()
        self._container.remove(v=True, force=True)
1374964
def shutdown(self, exitcode=0, exitmsg=None):
        '''
        
        '''
        log.info('The salt-api is shutting down..')
        msg = 'The salt-api is shutdown. '
        if exitmsg is not None:
            exitmsg = msg + exitmsg
        else:
            exitmsg = msg.strip()
        super(SaltAPI, self).shutdown(exitcode, exitmsg)
228845
def shutdown(self):
        ''' 
        '''
        logging.info('Shutdown procedures being run!')
        for func in self.shutdown_cleanup.values():
            func()
        session_time = round((time.time() - self.start_time)/60, 0)
        logging.info('session time: {0} minutes'.format(session_time))
        logging.info('End..')
1095740
public static function shutdown()
    {
        global $PPHP;
        $req = grab('request');

        if (!$req['binary']) {
            $body = ob_get_contents();
            ob_end_clean();
            try {
                array_merge_assoc(
                    self::$_stash,
                    array(
                        'body' => self::$_safeBody,
                        'stdout' => $body,
                        'config' => $PPHP['config'],
                        'session' => $_SESSION,
                        'req' => grab('request')
                    )
                );
                self::$_template->displayBlock('body', self::$_stash);
            } catch (\Exception $e) {
                echo $e->getMessage();
            };
        };
    }
386515
protected function registerShutdownCallback()
    {
        $this->swooleServer->on('Shutdown', function () {
            $this->events->dispatch(new Events\ServerShutdown($this));

            $this->dispatchEvent('Shutdown', $this);
        });
    }
219900
public static function applyShutdownFunction()
    {
        Base::getLog()->debug(__METHOD__ . ' apply shutdown functions');
        foreach (self::$shutdownFunctions as $pair)
        {
            call_user_func_array(Arr::get($pair, 'callback'), Arr::get($pair, 'params'));
        }
    }
583928
public function shutdown()
    {

        // check if there was a fatal error caused shutdown
        if ($lastError = error_get_last()) {
            // initialize error type and 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) {
                $this->log(LogLevel::ERROR, $message);
            }
        }
    }
274511
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) {
                $this->getApplication()->getInitialContext()->getSystemLogger()->error($message);
            }
        }
    }
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();
        }
    }
1281597
public function shutdown()
    {
        foreach ($this->shutdown_functions as $function) {
            call_user_func($function);
        }

        // write session data as soon as possible and before
        // closing database connection, don't do this before
        // registered shutdown functions, they may need the session
        // Note: this will run registered gc handlers (ie. cache gc)
        if ($_SERVER['REMOTE_ADDR'] && is_object($this->session)) {
            $this->session->write_close();
        }

        if (is_object($this->smtp)) {
            $this->smtp->disconnect();
        }

        foreach ($this->caches as $cache) {
            if (is_object($cache)) {
                $cache->close();
            }
        }

        if (is_object($this->storage)) {
            $this->storage->close();
        }

        if ($this->config->get('log_driver') == 'syslog') {
            closelog();
        }
    }
929927
public function shutdown()
    {

        // query whether or not, class has been shutdown by an unhandled error
        if ($lastError = error_get_last()) {
            // add the passed error information to the array with the errors
            $error = ErrorUtil::singleton()->fromArray($lastError);
            // log the error messge and return TRUE, to prevent execution of additinoal error handlers
            LoggerUtils::log(LogLevel::ERROR, ErrorUtil::singleton()->prepareMessage($error));
        }
    }