????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 216.73.216.86 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/standard/tests/file/ |
Upload File : |
--TEST-- Test copy() function: usage variations - copy data file across dirs --SKIPIF-- <?php if(substr(PHP_OS, 0, 3) != "WIN") die("skip Run only on Windows"); ?> --FILE-- <?php /* Prototype: bool copy ( string $source, string $dest ); Description: Makes a copy of the file source to dest. Returns TRUE on success or FALSE on failure. */ /* Test copy() function: Trying to create copy of source file into different destination dir paths given in various notations */ echo "*** Testing copy() function: copying data file across directories ***\n"; $base_dir = dirname(__FILE__)."/copy_variation16"; mkdir($base_dir); $sub_dir = $base_dir."/copy_variation16_sub"; mkdir($sub_dir); $dirname_with_blank = $sub_dir."/copy variation16"; mkdir($dirname_with_blank); $src_file_name = dirname(__FILE__)."/copy_variation16.tmp"; $file_handle = fopen($src_file_name, "w"); fwrite($file_handle, str_repeat(b"Hello world, this is 2007 year ...\n", 100)); fclose($file_handle); echo "- Size of source file => "; var_dump( filesize($src_file_name) ); clearstatcache(); $dests = array( $base_dir."/copy_copy_variation16.tmp", $base_dir."/copy_variation16_sub/copy_copy_variation16.tmp", "$sub_dir/copy_copy_variation16.tmp", "$sub_dir/../copy_copy_variation16.tmp", "$sub_dir/../copy_variation16_sub/copy_copy_variation16.tmp", "$sub_dir/..///../copy_copy_variation16.tmp", "$sub_dir/..///../*", "$dirname_with_blank/copy_copy_variation16.tmp" ); echo "\n--- Now applying copy() on source file to create copies ---"; $count = 1; foreach($dests as $dest) { echo "\n-- Iteration $count --\n"; echo "Size of source file => "; var_dump( filesize($src_file_name) ); echo "Copy operation => "; var_dump( copy($src_file_name, $dest) ); echo "Existence of destination file => "; var_dump( file_exists($dest) ); if( file_exists($dest) ){ echo "Destination file name is => "; print($dest); echo "\n"; echo "Size of destination file => "; var_dump( filesize($dest) ); clearstatcache(); unlink("$dest"); } $count++; } unlink($src_file_name); rmdir($dirname_with_blank); rmdir($sub_dir); rmdir($base_dir); echo "*** Done ***\n"; ?> --EXPECTF-- *** Testing copy() function: copying data file across directories *** - Size of source file => int(3500) --- Now applying copy() on source file to create copies --- -- Iteration 1 -- Size of source file => int(3500) Copy operation => bool(true) Existence of destination file => bool(true) Destination file name is => %s/copy_variation16/copy_copy_variation16.tmp Size of destination file => int(3500) -- Iteration 2 -- Size of source file => int(3500) Copy operation => bool(true) Existence of destination file => bool(true) Destination file name is => %s/copy_variation16/copy_variation16_sub/copy_copy_variation16.tmp Size of destination file => int(3500) -- Iteration 3 -- Size of source file => int(3500) Copy operation => bool(true) Existence of destination file => bool(true) Destination file name is => %s/copy_variation16/copy_variation16_sub/copy_copy_variation16.tmp Size of destination file => int(3500) -- Iteration 4 -- Size of source file => int(3500) Copy operation => bool(true) Existence of destination file => bool(true) Destination file name is => %s/copy_variation16/copy_variation16_sub/../copy_copy_variation16.tmp Size of destination file => int(3500) -- Iteration 5 -- Size of source file => int(3500) Copy operation => bool(true) Existence of destination file => bool(true) Destination file name is => %s/copy_variation16/copy_variation16_sub/../copy_variation16_sub/copy_copy_variation16.tmp Size of destination file => int(3500) -- Iteration 6 -- Size of source file => int(3500) Copy operation => bool(true) Existence of destination file => bool(true) Destination file name is => %s/copy_variation16/copy_variation16_sub/..///../copy_copy_variation16.tmp Size of destination file => int(3500) -- Iteration 7 -- Size of source file => int(3500) Copy operation => Warning: copy(%s): failed to open stream: No such file or directory in %s on line %s bool(false) Existence of destination file => bool(false) -- Iteration 8 -- Size of source file => int(3500) Copy operation => bool(true) Existence of destination file => bool(true) Destination file name is => %s/copy_variation16/copy_variation16_sub/copy variation16/copy_copy_variation16.tmp Size of destination file => int(3500) *** Done ***