xref: /PHP-8.2/ext/standard/tests/file/006_error.phpt (revision 7c8a3e42)
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 non-existing file or dir */
15var_dump( chmod(__DIR__ . "/no/such/file/dir", 0777) );
16var_dump( fileperms(__DIR__ . "/no/such/file/dir") );
17echo "\n";
18
19echo "\n*** Done ***\n";
20?>
21--EXPECTF--
22*** Testing error conditions for fileperms(), chmod() ***
23
24Warning: chmod(): %s in %s on line %d
25bool(false)
26
27Warning: fileperms(): stat failed for %s/no/such/file/dir in %s on line %d
28bool(false)
29
30
31*** Done ***
32