1--TEST--
2Test file_get_contents() function : variation - linked files
3--CREDITS--
4Dave Kelsey <d_kelsey@uk.ibm.com>
5--SKIPIF--
6<?php
7if(substr(PHP_OS, 0, 3) == "WIN")
8  die("skip Do not run on Windows");
9?>
10--FILE--
11<?php
12/* Prototype  : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]])
13 * Description: Read the entire file into a string
14 * Source code: ext/standard/file.c
15 * Alias to functions:
16 */
17
18echo "*** Testing file_get_contents() : variation ***\n";
19$filename = dirname(__FILE__).'/fileGetContentsVar9.tmp';
20$softlink = dirname(__FILE__).'/fileGetContentsVar9.SoftLink';
21$hardlink = dirname(__FILE__).'/fileGetContentsVar9.HardLink';
22$chainlink = dirname(__FILE__).'/fileGetContentsVar9.ChainLink';
23
24// create file
25$h = fopen($filename,"w");
26//Data should be more than the size of a link.
27for ($i = 1; $i <= 10; $i++) {
28   fwrite($h, b"Here is a repeated amount of data");
29}
30fclose($h);
31
32// link files
33link($filename, $hardlink);
34symlink($filename, $softlink);
35symlink($softlink, $chainlink);
36
37// perform tests
38var_dump(file_get_contents($chainlink));
39var_dump(file_get_contents($softlink));
40var_dump(file_get_contents($hardlink));
41
42unlink($chainlink);
43unlink($softlink);
44unlink($hardlink);
45unlink($filename);
46
47echo "\n*** Done ***\n";
48?>
49--EXPECTF--
50*** Testing file_get_contents() : variation ***
51string(330) "Here is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of data"
52string(330) "Here is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of data"
53string(330) "Here is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of data"
54
55*** Done ***
56
57