In PHP 7.0:
$a = 'this';
return isset( $$a );
// returns true
But in PHP 7.1:
$a = 'this';
return isset( $$a );
// returns false
Does anyone know why this happens?
In PHP 7.0:
$a = 'this';
return isset( $$a );
// returns true
But in PHP 7.1:
$a = 'this';
return isset( $$a );
// returns false
Does anyone know why this happens?
 
    
    This is related to this change in 7.1:
Inconsistency fixes to
$thisWhilst
$thisis considered a special variable in PHP, it lacked proper checks to ensure it wasn't used as a variable name or reassigned. This has now been rectified to ensure that$thiscannot be a user-defined variable, reassigned to a different value, or be globalised.
This RFC explains it in more detail, though it also says:
Disable ability to re-assign
$thisindirectly through$$An attempt to re-assign
$thisthrough$$assignment will lead to throwing of Error exception.$a = "this"; $$a = 42; // throw new Error("Cannot re-assign $this")It's still possible to read
$thisvalue through$$.
(Emphasis mine.)
isset seems to have its own special treatment of $$ for $this which prohibits it from seeing it. I'm not sure if that's intentional or a byproduct of these changes.
