1--TEST--
2Test unlink() function : usage variations - unlink file in use
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == 'WIN') {
6    die('skip only on Linux');
7}
8?>
9--FILE--
10<?php
11/* Prototype : bool unlink ( string $filename [, resource $context] );
12   Description : Deletes filename
13*/
14
15/* Try to unlink file when file handle is still in use */
16
17$file_path = dirname(__FILE__);
18
19echo "*** Testing unlink() on a file which is in use ***\n";
20// temp file name used here
21$filename = "$file_path/unlink_variation2.tmp";
22
23// create file
24$fp = fopen($filename, "w");
25// try unlink() on $filename
26var_dump( unlink($filename) );  // expected: true on linux
27var_dump( file_exists($filename) );  // confirm file is deleted
28// now close file handle
29fclose($fp);
30
31echo "Done\n";
32?>
33--EXPECTF--
34*** Testing unlink() on a file which is in use ***
35bool(true)
36bool(false)
37Done
38