Skip to content

Instantly share code, notes, and snippets.

@garbast
Created February 26, 2016 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garbast/17b2873375f4c6a27008 to your computer and use it in GitHub Desktop.
Save garbast/17b2873375f4c6a27008 to your computer and use it in GitHub Desktop.
Quick solution for requests
diff --git a/typo3/sysext/core/Classes/Http/ServerRequestFactory.php b/typo3/sysext/core/Classes/Http/ServerRequestFactory.php
index bee3e59..7b9cf82 100644
--- a/typo3/sysext/core/Classes/Http/ServerRequestFactory.php
+++ b/typo3/sysext/core/Classes/Http/ServerRequestFactory.php
@@ -27,6 +27,23 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
class ServerRequestFactory
{
/**
+ * First request instantiated
+ *
+ * @var ServerRequest
+ */
+ protected static $initialRequest;
+
+ /**
+ * Returns the first request instantiated from superglobal variables.
+ *
+ * @return ServerRequest
+ */
+ public static function getInitialRequest()
+ {
+ return self::$initialRequest;
+ }
+
+ /**
* Create a request from the original superglobal variables.
*
* @return ServerRequest
@@ -61,6 +78,9 @@ class ServerRequestFactory
if (!empty($parsedBody)) {
$request = $request->withParsedBody($parsedBody);
}
+ if (is_null(self::$initialRequest)) {
+ self::$initialRequest = $request;
+ }
return $request;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment