--- /dev/null
+<?php
+
+namespace wcf\http\middleware;
+
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use Psr\Http\Server\MiddlewareInterface;
+use Psr\Http\Server\RequestHandlerInterface;
+use wcf\system\exception\NamedUserException;
+use wcf\system\request\RequestHandler;
+use wcf\system\WCF;
+
+/**
+ * Checks whether the system environment is unacceptable and prevents processing in that case.
+ *
+ * @author Tim Duesterhus
+ * @copyright 2001-2022 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\Http\Middleware
+ * @since 5.6
+ */
+final class CheckSystemEnvironment implements MiddlewareInterface
+{
+ /**
+ * @inheritDoc
+ */
+ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
+ {
+ if (!RequestHandler::getInstance()->isACPRequest()) {
+ if (!(80100 <= \PHP_VERSION_ID && \PHP_VERSION_ID <= 80199)) {
+ \header('HTTP/1.1 500 Internal Server Error');
+
+ throw new NamedUserException(WCF::getLanguage()->get('wcf.global.incompatiblePhpVersion'));
+ }
+ }
+
+ return $handler->handle($request);
+ }
+}
use wcf\http\middleware\CheckForEnterpriseNonOwnerAccess;
use wcf\http\middleware\CheckForExpiredAppEvaluation;
use wcf\http\middleware\CheckForOfflineMode;
+use wcf\http\middleware\CheckSystemEnvironment;
use wcf\http\middleware\EnforceCacheControlPrivate;
use wcf\http\middleware\EnforceFrameOptions;
use wcf\http\Pipeline;
$psrRequest = ServerRequestFactory::fromGlobals();
- $this->checkSystemEnvironment();
-
// build request
$this->buildRequest($application);
new AddAcpSecurityHeaders(),
new EnforceCacheControlPrivate(),
new EnforceFrameOptions(),
+ new CheckSystemEnvironment(),
new CheckForEnterpriseNonOwnerAccess(),
new CheckForExpiredAppEvaluation(),
new CheckForOfflineMode(),
}
}
- private function checkSystemEnvironment()
- {
- if ($this->isACPRequest()) {
- return;
- }
-
- if (!(80100 <= PHP_VERSION_ID && PHP_VERSION_ID <= 80199)) {
- \header('HTTP/1.1 500 Internal Server Error');
-
- throw new NamedUserException(WCF::getLanguage()->get('wcf.global.incompatiblePhpVersion'));
- }
- }
-
/**
* Builds a new request.
*