Closed
Description
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},
}