1--TEST-- 2Test is_executable() function: usage variations - invalid file names 3--SKIPIF-- 4<?php 5if (substr(PHP_OS, 0, 3) == 'WIN') { 6 die('skip not for windows'); 7} 8// Skip if being run by root (files are always readable, writeable and executable) 9$filename = dirname(__FILE__)."/is_executable_root_check.tmp"; 10$fp = fopen($filename, 'w'); 11fclose($fp); 12if(fileowner($filename) == 0) { 13 unlink ($filename); 14 die('skip cannot be run as root'); 15} 16 17unlink($filename); 18?> 19--FILE-- 20<?php 21/* Prototype: bool is_executable ( string $filename ); 22 Description: Tells whether the filename is executable 23*/ 24 25/* test is_executable() with invalid arguments */ 26 27echo "*** Testing is_executable(): usage variations ***\n"; 28 29$file_handle = fopen(__FILE__, "r"); 30unset($file_handle); 31 32echo "\n*** Testing is_executable() on invalid files ***\n"; 33$invalid_files = array( 34 0, 35 1234, 36 -2.34555, 37 TRUE, 38 FALSE, 39 NULL, 40 " ", 41 @array(), 42 @$file_handle 43); 44/* loop through to test each element in the above array 45 is an executable file */ 46foreach( $invalid_files as $invalid_file ) { 47 var_dump( is_executable($invalid_file) ); 48 clearstatcache(); 49} 50 51echo "Done\n"; 52?> 53--EXPECTF-- 54*** Testing is_executable(): usage variations *** 55 56*** Testing is_executable() on invalid files *** 57bool(false) 58bool(false) 59bool(false) 60bool(false) 61bool(false) 62bool(false) 63bool(false) 64 65Warning: is_executable() expects parameter 1 to be a valid path, array given in %s on line %d 66NULL 67bool(false) 68Done 69 70