[VarDumper] Use \ReflectionReference for determining if a key is a reference (php >= 7.4)
This commit is contained in:
parent
376a8f4cab
commit
e99a6b85b8
@ -86,8 +86,15 @@ class VarCloner extends AbstractCloner
|
|||||||
}
|
}
|
||||||
foreach ($vals as $k => $v) {
|
foreach ($vals as $k => $v) {
|
||||||
// $v is the original value or a stub object in case of hard references
|
// $v is the original value or a stub object in case of hard references
|
||||||
|
|
||||||
|
if (\PHP_VERSION_ID >= 70400) {
|
||||||
|
$zvalIsRef = null !== \ReflectionReference::fromArrayElement($vals, $k);
|
||||||
|
} else {
|
||||||
$refs[$k] = $cookie;
|
$refs[$k] = $cookie;
|
||||||
if ($zvalIsRef = $vals[$k] === $cookie) {
|
$zvalIsRef = $vals[$k] === $cookie;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($zvalIsRef) {
|
||||||
$vals[$k] = &$stub; // Break hard references to make $queue completely
|
$vals[$k] = &$stub; // Break hard references to make $queue completely
|
||||||
unset($stub); // independent from the original structure
|
unset($stub); // independent from the original structure
|
||||||
if ($v instanceof Stub && isset($hardRefs[spl_object_hash($v)])) {
|
if ($v instanceof Stub && isset($hardRefs[spl_object_hash($v)])) {
|
||||||
|
Reference in New Issue
Block a user