forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement delyed early binding for classes without parents
Fixes phpGH-8846
- Loading branch information
Showing
6 changed files
with
72 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
class Foo { | ||
const BAR = true; | ||
} |
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,5 @@ | ||
<?php | ||
var_dump(Foo::BAR); | ||
class Foo { | ||
const BAR = true; | ||
} |
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,39 @@ | ||
--TEST-- | ||
Bug GH-8846: Delayed early binding can be used for classes without parents | ||
--EXTENSIONS-- | ||
opcache | ||
--CONFLICTS-- | ||
server | ||
--INI-- | ||
opcache.validate_timestamps=1 | ||
opcache.revalidate_freq=0 | ||
--FILE-- | ||
<?php | ||
|
||
file_put_contents(__DIR__ . '/gh8846-index.php', <<<'PHP' | ||
<?php | ||
if (!@$_GET['skip']) { | ||
include __DIR__ . '/gh8846-1.inc'; | ||
} | ||
include __DIR__ . '/gh8846-2.inc'; | ||
echo "Ok\n"; | ||
PHP); | ||
|
||
include 'php_cli_server.inc'; | ||
php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1'); | ||
|
||
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/gh8846-index.php'); | ||
echo "\n"; | ||
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/gh8846-index.php?skip=1'); | ||
?> | ||
--CLEAN-- | ||
<?php | ||
@unlink(__DIR__ . '/gh8846-index.php'); | ||
?> | ||
--EXPECTF-- | ||
bool(true) | ||
<br /> | ||
<b>Fatal error</b>: Cannot declare class Foo, because the name is already in use in <b>%sgh8846-2.inc</b> on line <b>%d</b><br /> | ||
|
||
bool(true) | ||
Ok |
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