Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[HttpKernel] Fix datacollector caster for reference object property#54072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
nicolas-grekas left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Nice, thanks for the test cases.
Here is the correct patch that fixes both aspect of the issue:
--- a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php+++ b/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php@@ -70,16 +70,21 @@ abstract class DataCollector implements DataCollectorInterface $casters = [ '*' => function ($v, array $a, Stub $s, $isNested) { if (!$v instanceof Stub) {+ $b = $a; foreach ($a as $k => $v) { if (!\is_object($v) || $v instanceof \DateTimeInterface || $v instanceof Stub) { continue; } try {- $a[$k] = new CutStub($v);+ $a[$k] = $s = new CutStub($v);++ if ($b[$k] === $s) {+ // we've hit a non-typed reference+ $a[$k] = $v;+ } } catch (\TypeError $e) {- $a[$k] = &$v;- unset($v);+ // we've hit a typed reference } } }
nicolas-grekas commentedMar 14, 2024
Can you please make the necessary changes to fix the CI on PHP 7.2+? (that could involve using |
b2a9d7d to457a3deComparenicolas-grekas commentedApr 12, 2024
Thank you@ebuildy. |
Uh oh!
There was an error while loading.Please reload this page.
As discussed on#49091:
Unit tests FAIL "Error: KO src/Symfony/Component/HttpKernel" --> normal