File tree Expand file tree Collapse file tree 6 files changed +33
-90
lines changed Expand file tree Collapse file tree 6 files changed +33
-90
lines changed Original file line number Diff line number Diff line change 66 . Fixed bug GH-13544 (Pre-PHP 8.2 compatibility for mt_srand with
77 unknown modes). (timwolla)
88
9+ - Standard:
10+ . Fixed bug GH-11808 (Live filesystem modified by tests). (nielsdos)
11+
91214 Mar 2024, PHP 8.3.4
1013
1114- Core:
Original file line number Diff line number Diff line change @@ -11,20 +11,9 @@ require __DIR__ . '/../skipif_root.inc';
1111<?php
1212echo "*** Testing error conditions for fileperms(), chmod() *** \n" ;
1313
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-
2514/* 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 " ) );
2817echo "\n" ;
2918
3019echo "\n*** Done *** \n" ;
@@ -34,16 +23,8 @@ echo "\n*** Done ***\n";
3423
3524Warning: chmod(): %s in %s on line %d
3625bool(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)
4526
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
4728bool(false)
4829
4930
Original file line number Diff line number Diff line change 22chroot()
33--SKIPIF--
44<?php
5- chdir ("/ " );
6- if (!@mkdir ("testtmpskipifdir " )) {
7- die ("skip for root only " );
8- }
9- rmdir ("testtmpskipifdir " );
105if (!function_exists ("chroot " )) {
116 die ("skip chroot() not available " );
127}
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+ }
1321?>
1422--FILE--
1523<?php
Original file line number Diff line number Diff line change 11--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
113--FILE--
124<?php
5+ chdir (__DIR__ );
6+ $ dirpath = "./tmp/foo//bar/logs " ;
7+ mkdir ($ dirpath , 0777 , true );
138
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/ " );
1918?>
2019--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