1--TEST--
2Test copy() function: usage variations - destination dir access perms
3--SKIPIF--
4<?php
5if(substr(PHP_OS, 0, 3) == 'WIN')
6  die("skip do not run on Windows");
7require __DIR__ . '/../skipif_root.inc';
8?>
9--FILE--
10<?php
11/* Test copy(): Trying to create a copy of file in a dir which doesn't have write permissions */
12
13$file_path = __DIR__;
14
15echo "*** Test copy() function: Trying to create a copy of file in a dir which doesn't have write permissions ***";
16$file = $file_path."/copy_variation15.tmp";
17$file_handle =  fopen($file, "w");
18fwrite($file_handle, str_repeat("Hello, world...", 20));
19fclose($file_handle);
20
21$dir = $file_path."/copy_variation15";
22mkdir($dir);
23
24$old_perms = fileperms($dir);
25
26chmod($dir, 0555);  //dir without write permissions
27
28$dest = $dir."/copy_copy_variation15.tmp";
29
30var_dump( copy($file, $dir."/copy_copy_variation15.tmp") );
31var_dump( file_exists($dir."/copy_copy_variation15_dir.tmp") );
32var_dump( filesize($file) );  //size of source
33
34chmod($dir, $old_perms);
35
36echo "*** Done ***\n";
37?>
38--CLEAN--
39<?php
40unlink(__DIR__."/copy_variation15.tmp");
41rmdir(__DIR__."/copy_variation15");
42?>
43--EXPECTF--
44*** Test copy() function: Trying to create a copy of file in a dir which doesn't have write permissions ***
45Warning: copy(%s): %s
46bool(false)
47bool(false)
48int(300)
49*** Done ***
50