Skip to content

Commit

Permalink
fix debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ArrayIterator committed Jul 15, 2024
1 parent 0feea39 commit ee75972
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
16 changes: 14 additions & 2 deletions src/Benchmark/Middlewares/DebuggingMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,32 @@

class DebuggingMiddleware extends AbstractMiddleware
{
protected int $priority = PHP_INT_MIN;
protected int $priority = PHP_INT_MAX;

use StreamFactoryTrait,
TranslatorTrait;

/**
* @var bool registered
*/
private bool $registered = false;

/**
* @var bool darkMode
*/
private bool $darkMode = false;

/**
* @var ?float
*/
/**
* @var ?float
*/
private ?float $requestFloat = null;

/**
* @inheritdoc
*/
protected function doProcess(
ServerRequestInterface $request
): ServerRequestInterface {
Expand Down Expand Up @@ -126,7 +138,7 @@ private function renderDebugBar($response) : mixed
// if profiler disabled, stop here!
$profiler = ContainerHelper::use(ProfilerInterface::class, $container);
$waterfall = ContainerHelper::use(Waterfall::class, $container);
if (!$profiler?->isEnable() || ! $waterfall || !DataType::isHtmlContentType($response)) {
if (!$profiler?->isEnable() || ! $waterfall || $response->getHeaderLine('Content-Type') !== '' && !DataType::isHtmlContentType($response)) {
return $response;
}

Expand Down
3 changes: 1 addition & 2 deletions src/HttpKernel/BaseKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ final public function init() : static
KernelCommandLoader::register($this);

// registering debug middleware at the first middleware
$httpKernel->addMiddleware($debugMiddleware);
$httpKernel->addDeferredMiddleware($debugMiddleware);
$httpKernel->addDeferredMiddleware($errorMiddleware);
return $this;
}
Expand Down Expand Up @@ -938,7 +938,6 @@ public function getRegisteredDirectories(): array
return $this->registeredDirectories;
}

/** @noinspection PhpUnused */
public function getAppNameSpace(): ?string
{
return $this->appNameSpace;
Expand Down

0 comments on commit ee75972

Please sign in to comment.