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