xref: /php-src/ext/opcache/tests/gh15021.phpt (revision 2e9cc9bc)
1--TEST--
2GH-15021: Optimizer only relies on preloaded top-level symbols
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.preload={PWD}/gh15021_preload.inc
7--EXTENSIONS--
8opcache
9--SKIPIF--
10<?php
11if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
12?>
13--FILE--
14<?php
15putenv('RUNTIME=1');
16$firstRun = !isset(opcache_get_status()['scripts'][__DIR__ . DIRECTORY_SEPARATOR . 'gh15021_required.inc']);
17
18if ($firstRun) {
19    require __DIR__ . '/gh15021_a.inc';
20    $expected = 1;
21} else {
22    require __DIR__ . '/gh15021_b.inc';
23    $expected = 2;
24}
25
26require __DIR__ . '/gh15021_required.inc';
27
28var_dump(f() === $expected);
29?>
30--EXPECT--
31bool(true)
32