MFH: Fixed #45181 (chdir() should clear relative entries in stat cache)

This commit is contained in:
Arnaud Le Blanc 2008-08-11 22:38:31 +00:00
parent 066ea4f66c
commit 6e20eba4f4
2 changed files with 26 additions and 0 deletions

View File

@ -26,6 +26,7 @@
#include "php_dir.h"
#include "php_string.h"
#include "php_scandir.h"
#include "basic_functions.h"
#ifdef HAVE_DIRENT_H
#include <dirent.h>
@ -330,6 +331,15 @@ PHP_FUNCTION(chdir)
RETURN_FALSE;
}
if (BG(CurrentStatFile) && !IS_ABSOLUTE_PATH(BG(CurrentStatFile), strlen(BG(CurrentStatFile)))) {
efree(BG(CurrentStatFile));
BG(CurrentStatFile) = NULL;
}
if (BG(CurrentLStatFile) && !IS_ABSOLUTE_PATH(BG(CurrentLStatFile), strlen(BG(CurrentLStatFile)))) {
efree(BG(CurrentLStatFile));
BG(CurrentLStatFile) = NULL;
}
RETURN_TRUE;
}
/* }}} */

View File

@ -0,0 +1,16 @@
--TEST--
Bug #45181 (chdir() should clear relative entries in stat cache)
--FILE--
<?php
mkdir("bug45181_x");
var_dump(is_dir("bug45181_x"));
chdir("bug45181_x");
var_dump(is_dir("bug45181_x"));
?>
--CLEAN--
<?php
rmdir("bug45181_x");
?>
--EXPECT--
bool(true)
bool(false)