-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed bug #51905 (ReflectionParameter fails if default value is an …
…array with an access to self::)
- Loading branch information
Showing
3 changed files
with
43 additions
and
1 deletion.
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
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
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,28 @@ | |||
--TEST-- | |||
Bug #51905 (ReflectionParameter fails if default value is an array with an access to self::) | |||
--FILE-- | |||
<?php | |||
|
|||
class Bar { | |||
const Y = 20; | |||
} | |||
|
|||
class Foo extends Bar { | |||
const X = 12; | |||
public function x($x = 1, $y = array(self::X), $z = parent::Y) {} | |||
} | |||
|
|||
$clazz = new ReflectionClass('Foo'); | |||
$method = $clazz->getMethod('x'); | |||
foreach ($method->getParameters() as $param) { | |||
if ( $param->isDefaultValueAvailable()) | |||
echo '$', $param->getName(), ' : ', var_export($param->getDefaultValue(), 1), "\n"; | |||
} | |||
|
|||
?> | |||
--EXPECT-- | |||
$x : 1 | |||
$y : array ( | |||
0 => 12, | |||
) | |||
$z : 20 |