-
-
Save nikita2206/915cac6efa1e25e5ded76accf718549a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class A | |
{ | |
private $a; | |
public function __construct($a) | |
{ | |
$this->a = $a; | |
} | |
} | |
class B extends A | |
{ | |
private $a; // extend A in order to force XDebug to use *A*a for `a` property of `A` | |
public function __construct($a, $pubA) | |
{ | |
parent::__construct($a); | |
$this->a = $pubA; | |
} | |
} | |
$collision = new B([[[123]]], "whatever"); | |
$collision->{"*A*a"} = 789; | |
$q = [[[$collision]]]; | |
xdebug_break(); | |
// now you won't be able to get the array `[[[123]]]` which lies by the | |
// path `$q[0][0][0]->*A*a` (where *A*a means field `a` in the scope of `A`) | |
// Instead, XDebug will always be returning `789` in the response rendering the value above unreachable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment