Skip to content

Prepare for PHP 7.4: use ReflectionReference in VarCloner #31135

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

Closed
nicolas-grekas opened this issue Apr 16, 2019 · 1 comment
Closed

Prepare for PHP 7.4: use ReflectionReference in VarCloner #31135

nicolas-grekas opened this issue Apr 16, 2019 · 1 comment

Comments

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Apr 16, 2019

In VarDumper's VarCloner, we use some black magic tricks to work with PHP references (called "hard references" in the code, i.e. $b = &$a).

In PHP 7.4, this will break with typed properties, because of the $cookie trick that is used to detect these references.

But PHP 7.4 has a solution: ReflectionReference

So, when PHP 7.4 is used, we can replace the current implementation by one based on ReflectionReference. That would make things both cleaner and compatible with typed-references.

While this might not be the most trivial part of the code to have a look at, the ETA of PHP 7.4 is early December. Anyone would like to give it a try?

@nicolas-grekas nicolas-grekas added the Help wanted Issues and PRs which are looking for volunteers to complete them. label Apr 16, 2019
@javiereguiluz javiereguiluz modified the milestone: next Apr 16, 2019
@dorumd
Copy link
Contributor

dorumd commented Apr 17, 2019

I'll give it a try and make a PoC.

@nicolas-grekas nicolas-grekas removed the Help wanted Issues and PRs which are looking for volunteers to complete them. label May 6, 2019
nicolas-grekas added a commit that referenced this issue 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants