8000 Symfony\Component\VarDumper\Caster\SymfonyCaster doesn't check array key exist · Issue #33751 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Symfony\Component\VarDumper\Caster\SymfonyCaster doesn't check array key exist #33751
Closed
@zcodes

Description

@zcodes

in the class method castRequest and castHttpClient, argument array $a is used without checking the array key exists, by default, there's no problem, but if there's filter before called SymfonyCaster (like in laravel's tinker), the array $a is empty, then it will raise an index error exception.

>>> use Symfony\Component\HttpClient\HttpClient;
>>> $c = HttpClient::create()
=> Symfony\Component\HttpClient\CurlHttpClient {#2993
     ⚠: Symfony\Component\VarDumper\Exception\ThrowingCasterException {#3000
       #message: "Unexpected ErrorException thrown from a caster: Undefined index: ",
     },
   }
>>> use Symfony\Component\HttpFoundation\Request;
>>> $r = new Request()
=> Symfony\Component\HttpFoundation\Request {#3006
     ⚠: Symfony\Component\VarDumper\Exception\ThrowingCasterException {#3024
       #message: "Unexpected ErrorException thrown from a caster: Undefined index: ",
     },
     +attributes: Symfony\Component\HttpFoundation\ParameterBag {#3005},
     +request: Symfony\Component\HttpFoundation\ParameterBag {#3008},
     +query: Symfony\Component\HttpFoundation\ParameterBag {#3001},
     +server: Symfony\Component\HttpFoundation\ServerBag {#2998},
     +files: Symfony\Component\HttpFoundation\FileBag {#3007},
     +cookies: Symfony\Component\HttpFoundation\ParameterBag {#3003},
     +headers: Symfony\Component\HttpFoundation\HeaderBag {#3004},
   }

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

      0