Description
Symfony version(s) affected
All maintained, from 5.4 and above
Description
Look on a third argument in a \Symfony\Component\HttpKernel\Profiler\Profiler::find
method:
https://github.com/symfony/symfony/blob/v5.4.0/src/Symfony/Component/HttpKernel/Profiler/Profiler.php#L127
It is ?string
, but then it passed to \Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface::find
it is awaited as ?int
:
https://github.com/symfony/symfony/blob/v5.4.0/src/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php#L36
And it is passed in three places:
- https://github.com/symfony/symfony/blob/v5.4.0/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php#L81 where we pass integer
1
- https://github.com/symfony/symfony/blob/v5.4.0/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php#L245
- https://github.com/symfony/symfony/blob/v5.4.0/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php#L292
In cases 2 and 3 we assume to pass integer too, but due to it's a request payload, it should be casted from string.
How to reproduce
If we use a strict type with file, which used \Symfony\Component\HttpKernel\Profiler\Profiler::find
and pass an integer as a third argument, the IDE will highlight this line as an error.
Possible Solution
Change the limit argument from string to integer and cast it in case of passing from a request payload.
Additional Context
No response