From bdbcc4b6d3372a5bb15fbafda831c325b859bc4e Mon Sep 17 00:00:00 2001 From: Jani Taskinen Date: Wed, 31 Oct 2007 13:23:07 +0000 Subject: MFH: - Fixed Bug #43137 (rmdir() and rename() do not clear statcache) --- main/streams/plain_wrapper.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'main') diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 74c1841950..438ba3aabd 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -24,6 +24,7 @@ #include "php_open_temporary_file.h" #include "ext/standard/file.h" #include "ext/standard/flock_compat.h" +#include "ext/standard/php_filestat.h" #include #include #if HAVE_SYS_WAIT_H @@ -1032,12 +1033,10 @@ static int php_plain_files_unlink(php_stream_wrapper *wrapper, char *url, int op } return 0; } + /* Clear stat cache */ - ZVAL_STRINGL(&funcname, "clearstatcache", sizeof("clearstatcache")-1, 0); - call_user_function_ex(CG(function_table), NULL, &funcname, &retval, 0, NULL, 0, NULL TSRMLS_CC); - if (retval) { - zval_ptr_dtor(&retval); - } + php_clear_stat_cache(TSRMLS_C); + return 1; } @@ -1107,6 +1106,9 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, char *url_from, c return 0; } + /* Clear stat cache */ + php_clear_stat_cache(TSRMLS_C); + return 1; } @@ -1151,7 +1153,7 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, char *dir, int mod } else { /* find a top level directory we need to create */ - while ( (p = strrchr(buf + offset, DEFAULT_SLASH)) || ( offset !=1 && (p = strrchr(buf, DEFAULT_SLASH))) ) { + while ( (p = strrchr(buf + offset, DEFAULT_SLASH)) || (offset != 1 && (p = strrchr(buf, DEFAULT_SLASH))) ) { int n = 0; *p = '\0'; @@ -1218,6 +1220,9 @@ static int php_plain_files_rmdir(php_stream_wrapper *wrapper, char *url, int opt return 0; } + /* Clear stat cache */ + php_clear_stat_cache(TSRMLS_C); + return 1; } @@ -1412,9 +1417,6 @@ stream_skip: } /* }}} */ - - - /* * Local variables: * tab-width: 4 -- cgit v1.2.1