xref: /php-src/ext/opcache/tests/gh8846.phpt (revision 1c30c5e7)
1--TEST--
2Bug GH-8846: Delayed early binding can be used for classes without parents
3--EXTENSIONS--
4opcache
5--CONFLICTS--
6server
7--INI--
8opcache.validate_timestamps=1
9opcache.revalidate_freq=0
10--FILE--
11<?php
12
13file_put_contents(__DIR__ . '/gh8846-index.php', <<<'PHP'
14<?php
15if (!@$_GET['skip']) {
16    include __DIR__ . '/gh8846-1.inc';
17}
18include __DIR__ . '/gh8846-2.inc';
19echo "Ok\n";
20PHP);
21
22include 'php_cli_server.inc';
23php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1');
24
25echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/gh8846-index.php');
26echo "\n";
27echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/gh8846-index.php?skip=1');
28?>
29--CLEAN--
30<?php
31@unlink(__DIR__ . '/gh8846-index.php');
32?>
33--EXPECTF--
34bool(true)
35<br />
36<b>Fatal error</b>:  Cannot redeclare class Foo (previously declared in %sgh8846-1.inc:2) in <b>%sgh8846-2.inc</b> on line <b>%d</b><br />
37
38bool(true)
39Ok
40