1--TEST-- 2Test fileperms(), chmod() functions: error conditions 3--SKIPIF-- 4<?php 5if (substr(PHP_OS, 0, 3) == 'WIN') { 6 die('skip Not on Windows'); 7} 8require __DIR__ . '/../skipif_root.inc'; 9?> 10--FILE-- 11<?php 12echo "*** Testing error conditions for fileperms(), chmod() ***\n"; 13 14/* With standard files and dirs */ 15var_dump( chmod("/etc/passwd", 0777) ); 16printf("%o", fileperms("/etc/passwd") ); 17echo "\n"; 18clearstatcache(); 19 20var_dump( chmod("/etc", 0777) ); 21printf("%o", fileperms("/etc") ); 22echo "\n"; 23clearstatcache(); 24 25/* With non-existing file or dir */ 26var_dump( chmod("/no/such/file/dir", 0777) ); 27var_dump( fileperms("/no/such/file/dir") ); 28echo "\n"; 29 30echo "\n*** Done ***\n"; 31?> 32--CLEAN-- 33<?php 34unlink( __DIR__."/006_error.tmp"); 35?> 36--EXPECTF-- 37*** Testing error conditions for fileperms(), chmod() *** 38 39Warning: chmod(): %s in %s on line %d 40bool(false) 41100%d44 42 43Warning: chmod(): %s in %s on line %d 44bool(false) 4540755 46 47Warning: chmod(): No such file or directory in %s on line %d 48bool(false) 49 50Warning: fileperms(): stat failed for /no/such/file/dir in %s on line %d 51bool(false) 52 53 54*** Done *** 55