Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpKernel] Incorrect limit argument type: string instead of integer #49656

Closed
@Aliance

Description

@Aliance

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:

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.

ide

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions