File tree 6 files changed +33
-90
lines changed
6 files changed +33
-90
lines changed Original file line number Diff line number Diff line change 6
6
. Fixed bug GH-13544 (Pre-PHP 8.2 compatibility for mt_srand with
7
7
unknown modes). (timwolla)
8
8
9
+ - Standard:
10
+ . Fixed bug GH-11808 (Live filesystem modified by tests). (nielsdos)
11
+
9
12
14 Mar 2024, PHP 8.3.4
10
13
11
14
- Core:
Original file line number Diff line number Diff line change @@ -11,20 +11,9 @@ require __DIR__ . '/../skipif_root.inc';
11
11
<?php
12
12
echo "*** Testing error conditions for fileperms(), chmod() *** \n" ;
13
13
14
- /* With standard files and dirs */
15
- var_dump ( chmod ("/etc/passwd " , 0777 ) );
16
- printf ("%o " , fileperms ("/etc/passwd " ) );
17
- echo "\n" ;
18
- clearstatcache ();
19
-
20
- var_dump ( chmod ("/etc " , 0777 ) );
21
- printf ("%o " , fileperms ("/etc " ) );
22
- echo "\n" ;
23
- clearstatcache ();
24
-
25
14
/* With non-existing file or dir */
26
- var_dump ( chmod ("/no/such/file/dir " , 0777 ) );
27
- var_dump ( fileperms ("/no/such/file/dir " ) );
15
+ var_dump ( chmod (__DIR__ . "/no/such/file/dir " , 0777 ) );
16
+ var_dump ( fileperms (__DIR__ . "/no/such/file/dir " ) );
28
17
echo "\n" ;
29
18
30
19
echo "\n*** Done *** \n" ;
@@ -34,16 +23,8 @@ echo "\n*** Done ***\n";
34
23
35
24
Warning: chmod(): %s in %s on line %d
36
25
bool(false)
37
- 100%d44
38
-
39
- Warning: chmod(): %s in %s on line %d
40
- bool(false)
41
- 40755
42
-
43
- Warning: chmod(): No such file or directory in %s on line %d
44
- bool(false)
45
26
46
- Warning: fileperms(): stat failed for /no/such/file/dir in %s on line %d
27
+ Warning: fileperms(): stat failed for %s /no/such/file/dir in %s on line %d
47
28
bool(false)
48
29
49
30
Original file line number Diff line number Diff line change 2
2
chroot()
3
3
--SKIPIF--
4
4
<?php
5
- chdir ("/ " );
6
- if (!@mkdir ("testtmpskipifdir " )) {
7
- die ("skip for root only " );
8
- }
9
- rmdir ("testtmpskipifdir " );
10
5
if (!function_exists ("chroot " )) {
11
6
die ("skip chroot() not available " );
12
7
}
8
+ // Skip if not being run by root (files are always readable, writeable and executable)
9
+ $ filename = @tempnam (__DIR__ , 'root_check_ ' );
10
+ if (!file_exists ($ filename )) {
11
+ die ('WARN Unable to create the "root check" file ' );
12
+ }
13
+
14
+ $ isRoot = fileowner ($ filename ) == 0 ;
15
+
16
+ unlink ($ filename );
17
+
18
+ if (!$ isRoot ) {
19
+ die ('SKIP Must be run as root ' );
20
+ }
13
21
?>
14
22
--FILE--
15
23
<?php
Original file line number Diff line number Diff line change 1
1
--TEST--
2
- recursive mkdir() tests
3
- --SKIPIF--
4
- <?php
5
- chdir ("/ " );
6
- if (!@mkdir ("testtmpskipifdir " )) {
7
- die ("skip for root only " );
8
- }
9
- rmdir ("testtmpskipifdir " );
10
- ?>
2
+ recursive mkdir() with unclean paths
11
3
--FILE--
12
4
<?php
5
+ chdir (__DIR__ );
6
+ $ dirpath = "./tmp/foo//bar/logs " ;
7
+ mkdir ($ dirpath , 0777 , true );
13
8
14
- var_dump (mkdir ("/testdir/subdir " , 0777 , true ));
15
- var_dump (rmdir ("/testdir/subdir " ));
16
- var_dump (rmdir ("/testdir " ));
17
-
18
- echo "Done \n" ;
9
+ if (is_dir ($ dirpath )) {
10
+ echo "Ok. \n" ;
11
+ } else {
12
+ echo "Failed. \n" ;
13
+ }
14
+ rmdir ("./tmp/foo/bar/logs " );
15
+ rmdir ("./tmp/foo/bar/ " );
16
+ rmdir ("./tmp/foo/ " );
17
+ rmdir ("./tmp/ " );
19
18
?>
20
19
--EXPECT--
21
- bool(true)
22
- bool(true)
23
- bool(true)
24
- Done
20
+ Ok.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments