]> granicus.if.org Git - php/commitdiff
clear stat cache in chroot()
authorArnaud Le Blanc <lbarnaud@php.net>
Mon, 11 Aug 2008 23:14:21 +0000 (23:14 +0000)
committerArnaud Le Blanc <lbarnaud@php.net>
Mon, 11 Aug 2008 23:14:21 +0000 (23:14 +0000)
ext/standard/dir.c
ext/standard/tests/file/chroot_001.phpt [new file with mode: 0644]

index b555936b460536d1db37aa0200cee753963d64ef..c4a21839a5d7147f74024907cc04ba08d22df6cb 100644 (file)
@@ -320,7 +320,7 @@ PHP_FUNCTION(chroot)
                RETURN_FALSE;
        }
 
-       realpath_cache_clean(TSRMLS_C);
+       php_clear_stat_cache(1, NULL, 0 TSRMLS_CC);
        
        ret = chdir("/");
        
diff --git a/ext/standard/tests/file/chroot_001.phpt b/ext/standard/tests/file/chroot_001.phpt
new file mode 100644 (file)
index 0000000..daa1a83
--- /dev/null
@@ -0,0 +1,30 @@
+--TEST--
+chroot()
+--SKIPIF--
+<?php
+chdir("/");
+if (!@mkdir("testtmpskipifdir")) {
+       die("skip for root only");
+}
+rmdir("testtmpskipifdir");
+if (!function_exists("chroot")) {
+       die("skip chroot() not available");
+}
+?>
+--FILE--
+<?php
+mkdir("chroot_001_x");
+var_dump(is_dir("chroot_001_x"));
+var_dump(chroot("chroot_001_x"));
+var_dump(is_dir("chroot_001_x"));
+var_dump(realpath("."));
+?>
+--CLEAN--
+<?php
+rmdir("chroot_001_x");
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+bool(false)
+%unicode|string%(1) "/"