????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 rename() function : variation - various relative, absolute paths --CREDITS-- Dave Kelsey <d_kelsey@uk.ibm.com> --SKIPIF-- <?php if (substr(PHP_OS, 0, 3) != 'WIN') die('skip.. for Windows'); ?> --FILE-- <?php /* Prototype : bool rename(string old_name, string new_name[, resource context]) * Description: Rename a file * Source code: ext/standard/file.c * Alias to functions: */ /* Creating unique files in various dirs by passing relative paths to $dir arg */ echo "*** Testing rename() with absolute and relative paths ***\n"; $mainDir = "renameVar11"; $subDir = "renameVar11Sub"; $absMainDir = dirname(__FILE__)."/".$mainDir; mkdir($absMainDir); $absSubDir = $absMainDir."/".$subDir; mkdir($absSubDir); $fromFile = "renameMe.tmp"; $toFile = "IwasRenamed.tmp"; $old_dir_path = getcwd(); chdir(dirname(__FILE__)); $allDirs = array( // absolute paths "$absSubDir/", "$absSubDir/../".$subDir, "$absSubDir//.././".$subDir, "$absSubDir/../../".$mainDir."/./".$subDir, "$absSubDir/..///".$subDir."//..//../".$subDir, "$absSubDir/BADDIR", // relative paths $mainDir."/".$subDir, $mainDir."//".$subDir, $mainDir."///".$subDir, "./".$mainDir."/../".$mainDir."/".$subDir, "BADDIR", ); for($i = 0; $i<count($allDirs); $i++) { $j = $i+1; $dir = $allDirs[$i]; echo "\n-- Iteration $j --\n"; touch($absSubDir."/".$fromFile); $res = rename($dir."/".$fromFile, $dir."/".$toFile); var_dump($res); if ($res == true) { $res = rename($dir."/".$toFile, $dir."/".$fromFile); var_dump($res); } unlink($absSubDir."/".$fromFile); } chdir($old_dir_path); rmdir($absSubDir); rmdir($absMainDir); echo "\n*** Done ***\n"; ?> --EXPECTF-- *** Testing rename() with absolute and relative paths *** -- Iteration 1 -- bool(true) bool(true) -- Iteration 2 -- bool(true) bool(true) -- Iteration 3 -- bool(true) bool(true) -- Iteration 4 -- bool(true) bool(true) -- Iteration 5 -- Warning: rename(%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/renameMe.tmp,%s/renameVar11/renameVar11Sub/..///renameVar11Sub//..//../renameVar11Sub/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) -- Iteration 6 -- Warning: rename(%s/renameVar11/renameVar11Sub/BADDIR/renameMe.tmp,%s/renameVar11/renameVar11Sub/BADDIR/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) -- Iteration 7 -- bool(true) bool(true) -- Iteration 8 -- bool(true) bool(true) -- Iteration 9 -- bool(true) bool(true) -- Iteration 10 -- bool(true) bool(true) -- Iteration 11 -- Warning: rename(BADDIR/renameMe.tmp,BADDIR/IwasRenamed.tmp): The system cannot find the path specified. (code: 3) in %s on line %d bool(false) *** Done ***