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