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

index ad0f5037cbd371d51ea31416d706d36c235ec7d8..06f8a2bb6d7386918f0b0ccac329d4b0148a16f9 100644 (file)
@@ -295,7 +295,7 @@ PHP_FUNCTION(chroot)
                RETURN_FALSE;
        }
 
-       realpath_cache_clean(TSRMLS_C);
+       php_clear_stat_cache(TSRMLS_C);
        
        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..b42b17b
--- /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)
+string(1) "/"