Skip to content

Commit 40b60e3

Browse files
committed
RoutingPanel: guard against non-string presenter/signal/action params
1 parent 6b6b71f commit 40b60e3

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/Bridges/ApplicationTracy/RoutingPanel.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Nette\Application\UI\Presenter;
1212
use Nette\Routing;
1313
use Tracy;
14+
use function is_string;
1415

1516

1617
/**
@@ -123,6 +124,9 @@ private function findSource(): \ReflectionClass|\ReflectionMethod|string|null
123124
{
124125
$params = $this->matched;
125126
$presenter = $params['presenter'] ?? '';
127+
if (!is_string($presenter)) {
128+
return null;
129+
}
126130
try {
127131
$class = $this->presenterFactory->getPresenterClass($presenter);
128132
} catch (Nette\Application\InvalidPresenterException) {
@@ -134,9 +138,10 @@ private function findSource(): \ReflectionClass|\ReflectionMethod|string|null
134138

135139
if (is_a($class, Nette\Application\UI\Presenter::class, allow_string: true)) {
136140
$rc = $class::getReflection();
137-
if (isset($params[Presenter::SignalKey])) {
141+
if (isset($params[Presenter::SignalKey]) && is_string($params[Presenter::SignalKey])) {
138142
return $rc->getSignalMethod($params[Presenter::SignalKey]);
139143
} elseif (isset($params[Presenter::ActionKey])
144+
&& is_string($params[Presenter::ActionKey])
140145
&& ($method = $rc->getActionRenderMethod($params[Presenter::ActionKey]))
141146
) {
142147
return $method;

0 commit comments

Comments
 (0)