mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
MFH: Fixed #45181 (chdir() should clear relative entries in stat cache)
This commit is contained in:
parent
066ea4f66c
commit
6e20eba4f4
@ -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;
|
||||
}
|
||||
/* }}} */
|
||||
|
16
ext/standard/tests/file/bug45181.phpt
Normal file
16
ext/standard/tests/file/bug45181.phpt
Normal 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)
|
Loading…
Reference in New Issue
Block a user