-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[VarDumper] Use \ReflectionReference for determining if a key is a reference (php >= 7.4) #31303
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@nicolas-grekas Ready for review. |
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.
Thanks, that's good step!
This highlights a PHP7.4 bug, reported as https://bugs.php.net/77951
Let's wait for the issue to be fixed before merging.
The bug has been fixed upstream, let's try again? Can you rerun the tests see if they pass now? |
Oh, would you mind doing a benchmark too? I'd be happy to know if the new way works faster than the current one. |
In theory, this should work, in practice, tests fail. |
37ee7db
to
4078294
Compare
@@ -68,8 +68,8 @@ public static function castObject($obj, $class, $hasDebugInfo = false) | |||
foreach ($a as $k => $v) { | |||
if (isset($k[0]) ? "\0" !== $k[0] : \PHP_VERSION_ID >= 70200) { | |||
if (!isset($publicProperties[$class])) { | |||
foreach (get_class_vars($class) as $prop => $v) { | |||
$publicProperties[$class][$prop] = true; | |||
foreach ((new \ReflectionClass($class))->getProperties(\ReflectionProperty::IS_PUBLIC) as $prop) { |
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.
need to account for https://bugs.php.net/78319
Thank you @dorumd. |
…key is a reference (php >= 7.4) (dorumd, nicolas-grekas) This PR was merged into the 3.4 branch. Discussion ---------- [VarDumper] Use \ReflectionReference for determining if a key is a reference (php >= 7.4) | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #31135 | License | MIT | Doc PR | - Prepare for PHP 7.4: use ReflectionReference in VarCloner Commits ------- 40f24ef [VarDumper] finish PHP 7.4 support and add tests e99a6b8 [VarDumper] Use \ReflectionReference for determining if a key is a reference (php >= 7.4)
Prepare for PHP 7.4: use ReflectionReference in VarCloner