-
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 #79897: Promoted constructor params with attribs cause crash
This was caused by the attribute AST being used twice, and was fixed by creating a temporary copy of it (and destroying said copy) when neccesary.
- Loading branch information
Showing
3 changed files
with
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--TEST-- | ||
bug79897: Promoted constructor params with attribs cause crash | ||
--FILE-- | ||
<?php | ||
|
||
@@Attribute | ||
class B { | ||
public function __construct($value) | ||
{ | ||
} | ||
} | ||
|
||
class A { | ||
public function __construct( | ||
@@B(12) public $b | ||
) | ||
{ | ||
} | ||
} | ||
|
||
var_dump((new ReflectionParameter(['A', '__construct'], 'b'))->getAttributes()[0]->getArguments()); | ||
var_dump((new ReflectionProperty('A', 'b'))->getAttributes()[0]->getArguments()); | ||
?> | ||
--EXPECT-- | ||
array(1) { | ||
[0]=> | ||
int(12) | ||
} | ||
array(1) { | ||
[0]=> | ||
int(12) | ||
} |
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