Skip to content

Commit 16bb8b8

Browse files
authored
Merge pull request #9 from Flowpack/neos-9-bugfixes
Neos 9 bugfixes
2 parents 1b8cbb3 + 9912f96 commit 16bb8b8

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

Classes/Aspect/CollectDebugInformationAspect.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
use Neos\Flow\Aop\JoinPointInterface;
2828
use Neos\Flow\ResourceManagement\PersistentResource;
2929
use Neos\Media\Domain\Model\AssetInterface;
30-
use Neos\Utility\ObjectAccess;
30+
use Psr\Http\Message\ResponseInterface;
31+
use Psr\Http\Message\StreamInterface;
3132

3233
#[Flow\Scope('singleton')]
3334
#[Flow\Aspect]
@@ -73,18 +74,18 @@ public function debuggingActive(): void
7374
}
7475

7576
#[Flow\Around("method(Neos\Neos\View\FusionView->render()) && Flowpack\Neos\Debug\Aspect\CollectDebugInformationAspect->debuggingActive")]
76-
public function addDebugValuesToNeosFusionView(JoinPointInterface $joinPoint): string|Response
77+
public function addDebugValuesToNeosFusionView(JoinPointInterface $joinPoint): string|ResponseInterface|StreamInterface
7778
{
7879
return $this->addDebugValues($joinPoint);
7980
}
8081

8182
#[Flow\Around("method(Neos\Fusion\View\FusionView->render()) && Flowpack\Neos\Debug\Aspect\CollectDebugInformationAspect->debuggingActive")]
82-
public function addDebugValuesToDefaultFusionView(JoinPointInterface $joinPoint): string|Response
83+
public function addDebugValuesToDefaultFusionView(JoinPointInterface $joinPoint): string|ResponseInterface|StreamInterface
8384
{
8485
return $this->addDebugValues($joinPoint);
8586
}
8687

87-
protected function addDebugValues(JoinPointInterface $joinPoint): string|Response
88+
protected function addDebugValues(JoinPointInterface $joinPoint): string|ResponseInterface|StreamInterface
8889
{
8990
$startRenderAt = microtime(true) * 1000;
9091
$response = $joinPoint->getAdviceChain()->proceed($joinPoint);
@@ -107,7 +108,7 @@ protected function addDebugValues(JoinPointInterface $joinPoint): string|Respons
107108
return $response;
108109
}
109110

110-
if ($response instanceof Response) {
111+
if ($response instanceof ResponseInterface) {
111112
$output = $response->getBody()?->getContents();
112113
$response->getBody()?->rewind();
113114

@@ -145,7 +146,7 @@ protected function addDebugValues(JoinPointInterface $joinPoint): string|Respons
145146
$this->contentContextMetricsCollector->getName() => $this->contentContextMetricsCollector->collect(),
146147
]
147148
];
148-
149+
$output = (string)$output;
149150
$debugOutput = '<!--__NEOS_DEBUG__ ' . json_encode($data) . '-->';
150151
$htmlEndPosition = strpos($output, '</html>');
151152

@@ -158,6 +159,11 @@ protected function addDebugValues(JoinPointInterface $joinPoint): string|Respons
158159
if ($response instanceof Response) {
159160
return $response->withBody(Utils::streamFor($output));
160161
}
162+
163+
if ($response instanceof StreamInterface) {
164+
return Utils::streamFor($output);
165+
}
166+
161167
return $output;
162168
}
163169

Resources/Private/Fusion/Fragments/Scripts.fusion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ prototype(Flowpack.Neos.Debug:Fragment.Scripts) < prototype(Neos.Fusion:Componen
44
</script>
55
`
66

7-
@if.notInBackend = ${!documentNode.context.inBackend}
7+
@if.notInBackend = ${documentNode.context && !documentNode.context.inBackend || renderingMode && !renderingMode.isEdit}
88
@if.isHtml = ${request.format == 'html'}
99
@if.isActive = ${Configuration.setting('Flowpack.Neos.Debug.enabled') && Configuration.setting('Flowpack.Neos.Debug.htmlOutput.enabled')}
1010
}

0 commit comments

Comments
 (0)