Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
TYPO3
content_replacer
Commits
e4956606
Commit
e4956606
authored
Aug 27, 2020
by
Tim Wagner
Browse files
[BUGFIX] StreamFactory does not exist in TYPO3 9
parent
6f1b585a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Classes/Middleware/ContentReplacerMiddleware.php
View file @
e4956606
...
...
@@ -36,6 +36,7 @@ use SGalinski\ContentReplacer\Service\CustomParserService;
use
SGalinski\ContentReplacer\Service\SpanParserService
;
use
TYPO3\CMS\Core\Context\Context
;
use
TYPO3\CMS\Core\Context\TypoScriptAspect
;
use
TYPO3\CMS\Core\Http\Stream
;
use
TYPO3\CMS\Core\Http\StreamFactory
;
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
use
TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager
;
...
...
@@ -90,8 +91,17 @@ class ContentReplacerMiddleware implements MiddlewareInterface {
$content
=
$this
->
parseAndReplace
(
$customParser
,
$content
);
}
$streamFactory
=
GeneralUtility
::
makeInstance
(
StreamFactory
::
class
);
return
$response
->
withBody
(
$streamFactory
->
createStream
(
$content
));
// StreamFactory is not available in TYPO3 9 yet.
if
(
version_compare
(
\
TYPO3\CMS\Core\Utility\VersionNumberUtility
::
getCurrentTypo3Version
(),
'10.0.0'
,
'<'
))
{
$stream
=
new
Stream
(
'php://temp'
,
'r+'
);
if
(
$content
!==
''
)
{
$stream
->
write
(
$content
);
}
}
else
{
$streamFactory
=
GeneralUtility
::
makeInstance
(
StreamFactory
::
class
);
$stream
=
$streamFactory
->
createStream
(
$content
);
}
return
$response
->
withBody
(
$stream
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment