bug #33919 [VarDumper] fix array key error for class SymfonyCaster (zcodes)

This PR was squashed before being merged into the 4.3 branch (closes #33919).

Discussion
----------

[VarDumper] fix array key error for class SymfonyCaster

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #33751
| License       | MIT
| Doc PR        | -

Commits
-------

1f20f35f74 [VarDumper] fix array key error for class SymfonyCaster
This commit is contained in:
Nicolas Grekas 2019-10-09 08:54:10 +02:00
commit 332d9e9067

View File

@ -30,7 +30,8 @@ class SymfonyCaster
$clone = null;
foreach (self::$requestGetters as $prop => $getter) {
if (null === $a[Caster::PREFIX_PROTECTED.$prop]) {
$key = Caster::PREFIX_PROTECTED.$prop;
if (\array_key_exists($key, $a) && null === $a[$key]) {
if (null === $clone) {
$clone = clone $request;
}
@ -44,7 +45,9 @@ class SymfonyCaster
public static function castHttpClient($client, array $a, Stub $stub, $isNested)
{
$multiKey = sprintf("\0%s\0multi", \get_class($client));
$a[$multiKey] = new CutStub($a[$multiKey]);
if (isset($a[$multiKey])) {
$a[$multiKey] = new CutStub($a[$multiKey]);
}
return $a;
}