Skip to content
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

[VarDumper] Use \ReflectionReference for determining if a key is a reference (php >= 7.4) #31303

Merged
merged 2 commits into from Jul 23, 2019

Conversation

dorumd
Copy link
Contributor

@dorumd dorumd commented Apr 28, 2019

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

@dorumd
Copy link
Contributor Author

dorumd commented Apr 28, 2019

@nicolas-grekas Ready for review.

@dorumd dorumd changed the title [VarDumper] Use \ReflectionReference for determining if a value is reference(php7.4 only) [VarDumper] Use \ReflectionReference for determining if a value is reference(php >= 7.4) Apr 28, 2019
@dorumd dorumd changed the base branch from master to 3.4 April 28, 2019 14:47
@nicolas-grekas nicolas-grekas added this to the 3.4 milestone Apr 29, 2019
Copy link
Member

@nicolas-grekas nicolas-grekas left a 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.

src/Symfony/Component/VarDumper/Cloner/VarCloner.php Outdated Show resolved Hide resolved
src/Symfony/Component/VarDumper/Cloner/VarCloner.php Outdated Show resolved Hide resolved
@nicolas-grekas
Copy link
Member

The bug has been fixed upstream, let's try again? Can you rerun the tests see if they pass now?

@nicolas-grekas
Copy link
Member

nicolas-grekas commented May 11, 2019

Oh, would you mind doing a benchmark too? I'd be happy to know if the new way works faster than the current one.

@nicolas-grekas
Copy link
Member

In theory, this should work, in practice, tests fail.
Waiting for feedback on https://bugs.php.net/78263
Could you please add a test case with a typed property that works by reference meanwhile?

@nicolas-grekas nicolas-grekas changed the title [VarDumper] Use \ReflectionReference for determining if a value is reference(php >= 7.4) [VarDumper] Use \ReflectionReference for determining if a key is a reference (php >= 7.4) Jul 22, 2019
@@ -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) {
Copy link
Member

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

src/Symfony/Component/VarDumper/Cloner/VarCloner.php Outdated Show resolved Hide resolved
@nicolas-grekas
Copy link
Member

Thank you @dorumd.

@nicolas-grekas nicolas-grekas merged commit 40f24ef into symfony:3.4 Jul 23, 2019
nicolas-grekas added a commit that referenced this pull request Jul 23, 2019
…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)
This was referenced Jul 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants