1--TEST--
2revalidate_path 01: OPCache must cache only resolved real paths when revalidate_path is set
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.revalidate_path=1
7--EXTENSIONS--
8opcache
9--CONFLICTS--
10server
11--FILE--
12<?php
13$dir = __DIR__;
14$dir1 = "$dir/test1";
15$dir2 = "$dir/test2";
16$link = "$dir/test";
17$file1 = "$dir1/index.php";
18$file2 = "$dir2/index.php";
19$main = "$dir/main.php";
20@mkdir($dir1);
21@mkdir($dir2);
22@file_put_contents($main,  '<?php include(\'' . $link .'/index.php\');');
23@file_put_contents($file1, "TEST 1\n");
24@file_put_contents($file2, "TEST 2\n");
25while (filemtime($file1) != filemtime($file2)) {
26    touch($file1);
27    touch($file2);
28}
29if (substr(PHP_OS, 0, 3) == 'WIN') {
30    @rmdir($link);
31    $ln = str_replace('/', '\\', $link);
32    $d1 = realpath($dir1);
33    `mklink /j $ln $d1`;
34} else {
35    @unlink($link);
36    @symlink($dir1, $link);
37}
38
39include "php_cli_server.inc";
40//php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.revalidate_path=1');
41php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.revalidate_path=1 -d opcache.file_update_protection=0 -d realpath_cache_size=0');
42echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
43echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
44if (substr(PHP_OS, 0, 3) == 'WIN') {
45    @rmdir($link);
46    $ln = str_replace('/', '\\', $link);
47    $d2 = realpath($dir2);
48    `mklink /j $ln $d2`;
49} else {
50    @unlink($link);
51    @symlink($dir2, $link);
52}
53echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
54echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
55?>
56--CLEAN--
57<?php
58$dir = __DIR__;
59$dir1 = "$dir/test1";
60$dir2 = "$dir/test2";
61$link = "$dir/test";
62$file1 = "$dir1/index.php";
63$file2 = "$dir2/index.php";
64$main = "$dir/main.php";
65@unlink($main);
66if (substr(PHP_OS, 0, 3) == 'WIN') {
67	@rmdir($link);
68} else {
69	@unlink($link);
70}
71@unlink($file1);
72@unlink($file2);
73@rmdir($dir1);
74@rmdir($dir2);
75?>
76--EXPECT--
77TEST 1
78TEST 1
79TEST 2
80TEST 2
81