1
0
mirror of https://github.com/php/php-src.git synced 2026-03-28 18:22:42 +01:00

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

This commit is contained in:
Arnaud Le Blanc
2008-08-11 22:39:42 +00:00
parent b9ab70c0d2
commit a1311b8bc2
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>
@@ -329,6 +330,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)