forked from php/php-src
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix preloading of constants containing enums
Fixes phpGH-8133
- Loading branch information
Showing
5 changed files
with
56 additions
and
23 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
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
enum Foo | ||
{ | ||
case Bar; | ||
case Baz; | ||
const CASES = [Foo::Bar, Foo::Baz]; | ||
} | ||
|
||
class Qux { | ||
const CASES = [Foo::Bar, Foo::Baz]; | ||
} |
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,33 @@ | ||
--TEST-- | ||
Enum preloading | ||
--EXTENSIONS-- | ||
opcache | ||
--INI-- | ||
opcache.enable=1 | ||
opcache.enable_cli=1 | ||
opcache.optimization_level=-1 | ||
opcache.preload={PWD}/gh8133.inc | ||
--SKIPIF-- | ||
<?php | ||
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows'); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
var_dump(Foo::CASES); | ||
var_dump(Qux::CASES); | ||
|
||
?> | ||
--EXPECT-- | ||
array(2) { | ||
[0]=> | ||
enum(Foo::Bar) | ||
[1]=> | ||
enum(Foo::Baz) | ||
} | ||
array(2) { | ||
[0]=> | ||
enum(Foo::Bar) | ||
[1]=> | ||
enum(Foo::Baz) | ||
} |