????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 216.73.216.238 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/dir/ |
Upload File : |
--TEST-- Test scandir() function : usage variations - different directory permissions --SKIPIF-- <?php if( substr(PHP_OS, 0, 3) == 'WIN') { die('skip Not for Windows'); } // Skip if being run by root (files are always readable, writeable and executable) $filename = dirname(__FILE__)."/dir_root_check.tmp"; $fp = fopen($filename, 'w'); fclose($fp); if(fileowner($filename) == 0) { unlink ($filename); die('skip...cannot be run as root\n'); } unlink($filename); ?> --FILE-- <?php /* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]]) * Description: List files & directories inside the specified path * Source code: ext/standard/dir.c */ /* * remove the execute permission from the parent dir and test scandir() on child dir * 1. remove write & execute permission from the 1st parent and test scandir() * 2. remove execute permission from 2nd parent and test scandir() */ echo "*** Testing scandir() : usage variations ***\n"; /* * create the temporary directory : * scandir_variation5 ( parent ) * |-> sub_dir ( sub parent ) * |-> child_dir ( child dir) */ $parent_dir_path = dirname(__FILE__) . "/scandir_variation5"; mkdir($parent_dir_path); chmod($parent_dir_path, 0777); // create sub_dir $sub_dir_path = $parent_dir_path . "/sub_dir"; mkdir($sub_dir_path); chmod($sub_dir_path, 0777); //create sub_sub_dir $child_dir_path = $sub_dir_path."/child_dir"; mkdir($child_dir_path); // remove the write and execute permisson from sub parent chmod($sub_dir_path, 0444); echo "\n-- After restricting 1st level parent directory --\n"; var_dump(scandir($child_dir_path)); // remove the execute permisson from parent dir, allowing all permission for sub dir chmod($sub_dir_path, 0777); // all permisson to sub dir chmod($parent_dir_path, 0666); // restricting parent directory echo "\n-- After restricting parent directory --\n"; var_dump(scandir($child_dir_path)); ?> ===DONE=== --CLEAN-- <?php $parent_dir_path = dirname(__FILE__) . "/scandir_variation5"; $sub_dir_path = $parent_dir_path."/sub_dir"; $child_dir_path = $sub_dir_path."/child_dir"; // changing permissions for each temporary directory to delete them chmod($parent_dir_path, 0777); chmod($sub_dir_path, 0777); chmod($child_dir_path, 0777); rmdir($child_dir_path); rmdir($sub_dir_path); rmdir($parent_dir_path); ?> --EXPECTF-- *** Testing scandir() : usage variations *** -- After restricting 1st level parent directory -- Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d Warning: scandir(): (errno %d): %s in %s on line %d bool(false) -- After restricting parent directory -- Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d Warning: scandir(): (errno %d): %s in %s on line %d bool(false) ===DONE===