Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed indirect modification of magic method arguments.
- Loading branch information
Showing
8 changed files
with
131 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--TEST-- | ||
Bug #75420.1 (Indirect modification of magic method argument) | ||
--FILE-- | ||
<?php | ||
class Test { | ||
public function __isset($x) { $GLOBALS["name"] = 24; return true; } | ||
public function __get($x) { var_dump($x); return 42; } | ||
} | ||
|
||
$obj = new Test; | ||
$name = "foo"; | ||
var_dump($obj->$name ?? 12); | ||
var_dump($name); | ||
?> | ||
--EXPECT-- | ||
string(3) "foo" | ||
int(42) | ||
int(24) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--TEST-- | ||
Bug #75420.2 (Indirect modification of magic method argument) | ||
--FILE-- | ||
<?php | ||
class Test { | ||
public function __isset($x) { $GLOBALS["name"] = 24; return true; } | ||
public function __get($x) { var_dump($x); return 42; } | ||
} | ||
|
||
$obj = new Test; | ||
$name = "foo"; | ||
$name = str_repeat($name, 2); | ||
var_dump($obj->$name ?? 12); | ||
var_dump($name); | ||
?> | ||
--EXPECT-- | ||
string(6) "foofoo" | ||
int(42) | ||
int(24) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--TEST-- | ||
Bug #75420.3 (Indirect modification of magic method argument) | ||
--FILE-- | ||
<?php | ||
class Test { | ||
public function __isset($x) { $GLOBALS["name"] = 24; return true; } | ||
public function __get($x) { var_dump($x); return 42; } | ||
} | ||
|
||
$obj = new Test; | ||
$name = "foo"; | ||
var_dump(empty($obj->$name)); | ||
var_dump($name); | ||
?> | ||
--EXPECT-- | ||
string(3) "foo" | ||
bool(false) | ||
int(24) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--TEST-- | ||
Bug #75420.4 (Indirect modification of magic method argument) | ||
--FILE-- | ||
<?php | ||
class Test { | ||
public function __isset($x) { $GLOBALS["name"] = 24; return true; } | ||
public function __get($x) { var_dump($x); return 42; } | ||
} | ||
|
||
$obj = new Test; | ||
$name = "foo"; | ||
$name = str_repeat($name, 2); | ||
var_dump(empty($obj->$name)); | ||
?> | ||
--EXPECT-- | ||
string(6) "foofoo" | ||
bool(false) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--TEST-- | ||
Bug #75420.5 (Indirect modification of magic method argument) | ||
--FILE-- | ||
<?php | ||
class Test { | ||
public function __isset($x) { $GLOBALS["obj"] = 24; return true; } | ||
public function __get($x) { var_dump($this); return 42; } | ||
} | ||
|
||
$obj = new Test; | ||
$name = "foo"; | ||
var_dump($obj->$name ?? 12); | ||
var_dump($obj); | ||
?> | ||
--EXPECT-- | ||
object(Test)#1 (0) { | ||
} | ||
int(42) | ||
int(24) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--TEST-- | ||
Bug #75420.6 (Indirect modification of magic method argument) | ||
--FILE-- | ||
<?php | ||
class Test { | ||
public function __isset($x) { $GLOBALS["obj"] = 24; return true; } | ||
public function __get($x) { var_dump($this); return 42; } | ||
} | ||
|
||
$obj = new Test; | ||
$name = "foo"; | ||
var_dump(empty($obj->$name)); | ||
var_dump($obj); | ||
?> | ||
--EXPECT-- | ||
object(Test)#1 (0) { | ||
} | ||
bool(false) | ||
int(24) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,5 +13,5 @@ $name = "foo"; | |
var_dump($obj->$name ?? 12); | ||
?> | ||
--EXPECT-- | ||
int(24) | ||
string(3) "foo" | ||
int(42) |
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