jani Wed Oct 31 13:23:07 2007 UTC Added files: (Branch: PHP_5_2) /php-src/ext/standard/tests/file bug43137.phpt
Modified files: /php-src NEWS /php-src/ext/openssl openssl.c /php-src/ext/standard filestat.c php_filestat.h /php-src/ext/standard/tests/file 005_basic.phpt 005_error.phpt /php-src/main/streams plain_wrapper.c Log: MFH: - Fixed Bug #43137 (rmdir() and rename() do not clear statcache)
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.992&r2=1.2027.2.547.2.993&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.992 php-src/NEWS:1.2027.2.547.2.993 --- php-src/NEWS:1.2027.2.547.2.992 Wed Oct 31 12:58:24 2007 +++ php-src/NEWS Wed Oct 31 13:23:05 2007 @@ -3,6 +3,7 @@ ?? ??? 2007, PHP 5.2.5RC2 - Added ability to control memory consumption between request using ZEND_MM_COMPACT environment variable. (Dmitry) +- Fixed bug #43137 (rmdir() and rename() do not clear statcache). (Jani) 18 Oct 2007, PHP 5.2.5RC1 - Upgraded PCRE to version 7.3 (Nuno) http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.41&r2=1.98.2.5.2.42&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41 php-src/ext/openssl/openssl.c:1.98.2.5.2.42 --- php-src/ext/openssl/openssl.c:1.98.2.5.2.41 Wed Aug 8 06:29:46 2007 +++ php-src/ext/openssl/openssl.c Wed Oct 31 13:23:06 2007 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: openssl.c,v 1.98.2.5.2.41 2007/08/08 06:29:46 pajoye Exp $ */ +/* $Id: openssl.c,v 1.98.2.5.2.42 2007/10/31 13:23:06 jani Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -46,6 +46,9 @@ #include <openssl/ssl.h> #include <openssl/pkcs12.h> +/* Common */ +#include <time.h> + #define DEFAULT_KEY_LENGTH 512 #define MIN_KEY_LENGTH 384 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/filestat.c?r1=1.136.2.8.2.14&r2=1.136.2.8.2.15&diff_format=u Index: php-src/ext/standard/filestat.c diff -u php-src/ext/standard/filestat.c:1.136.2.8.2.14 php-src/ext/standard/filestat.c:1.136.2.8.2.15 --- php-src/ext/standard/filestat.c:1.136.2.8.2.14 Fri Sep 21 14:05:18 2007 +++ php-src/ext/standard/filestat.c Wed Oct 31 13:23:06 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: filestat.c,v 1.136.2.8.2.14 2007/09/21 14:05:18 tony2001 Exp $ */ +/* $Id: filestat.c,v 1.136.2.8.2.15 2007/10/31 13:23:06 jani Exp $ */ #include "php.h" #include "safe_mode.h" @@ -698,14 +698,10 @@ /* }}} */ #endif -/* {{{ proto void clearstatcache(void) - Clear file stat cache */ -PHP_FUNCTION(clearstatcache) +/* {{{ php_clear_stat_cache() +*/ +PHPAPI void php_clear_stat_cache(TSRMLS_D) { - if (ZEND_NUM_ARGS()) { - WRONG_PARAM_COUNT; - } - if (BG(CurrentStatFile)) { efree(BG(CurrentStatFile)); BG(CurrentStatFile) = NULL; @@ -718,6 +714,17 @@ } /* }}} */ +/* {{{ proto void clearstatcache(void) + Clear file stat cache */ +PHP_FUNCTION(clearstatcache) +{ + if (ZEND_NUM_ARGS()) { + WRONG_PARAM_COUNT; + } + php_clear_stat_cache(TSRMLS_C); +} +/* }}} */ + #define IS_LINK_OPERATION(__t) ((__t) == FS_TYPE || (__t) == FS_IS_LINK || (__t) == FS_LSTAT) #define IS_EXISTS_CHECK(__t) ((__t) == FS_EXISTS || (__t) == FS_IS_W || (__t) == FS_IS_R || (__t) == FS_IS_X || (__t) == FS_IS_FILE || (__t) == FS_IS_DIR || (__t) == FS_IS_LINK) #define IS_ABLE_CHECK(__t) ((__t) == FS_IS_R || (__t) == FS_IS_W || (__t) == FS_IS_X) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/php_filestat.h?r1=1.24.2.4.2.1&r2=1.24.2.4.2.2&diff_format=u Index: php-src/ext/standard/php_filestat.h diff -u php-src/ext/standard/php_filestat.h:1.24.2.4.2.1 php-src/ext/standard/php_filestat.h:1.24.2.4.2.2 --- php-src/ext/standard/php_filestat.h:1.24.2.4.2.1 Mon Jan 1 09:36:08 2007 +++ php-src/ext/standard/php_filestat.h Wed Oct 31 13:23:06 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_filestat.h,v 1.24.2.4.2.1 2007/01/01 09:36:08 sebastian Exp $ */ +/* $Id: php_filestat.h,v 1.24.2.4.2.2 2007/10/31 13:23:06 jani Exp $ */ #ifndef PHP_FILESTAT_H #define PHP_FILESTAT_H @@ -87,6 +87,7 @@ typedef int php_stat_len; #endif +PHPAPI void php_clear_stat_cache(TSRMLS_D); PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int type, zval *return_value TSRMLS_DC); /* Switches for various filestat functions: */ http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/005_basic.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/standard/tests/file/005_basic.phpt diff -u php-src/ext/standard/tests/file/005_basic.phpt:1.1.2.1 php-src/ext/standard/tests/file/005_basic.phpt:1.1.2.2 --- php-src/ext/standard/tests/file/005_basic.phpt:1.1.2.1 Mon Jun 11 16:14:59 2007 +++ php-src/ext/standard/tests/file/005_basic.phpt Wed Oct 31 13:23:06 2007 @@ -1,5 +1,5 @@ --TEST-- -Test fileatime(),filemtime(),filectime() & touch() functions : basic functionality +Test fileatime(), filemtime(), filectime() & touch() functions : basic functionality --FILE-- <?php /* http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/005_error.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/standard/tests/file/005_error.phpt diff -u php-src/ext/standard/tests/file/005_error.phpt:1.1.2.1 php-src/ext/standard/tests/file/005_error.phpt:1.1.2.2 --- php-src/ext/standard/tests/file/005_error.phpt:1.1.2.1 Mon Jun 11 16:14:59 2007 +++ php-src/ext/standard/tests/file/005_error.phpt Wed Oct 31 13:23:06 2007 @@ -1,5 +1,5 @@ --TEST-- -Test fileatime(), filemtime(), filectime() & touch() functions: error conditions +Test fileatime(), filemtime(), filectime() & touch() functions : error conditions --FILE-- <?php /* http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.52.2.6.2.23&r2=1.52.2.6.2.24&diff_format=u Index: php-src/main/streams/plain_wrapper.c diff -u php-src/main/streams/plain_wrapper.c:1.52.2.6.2.23 php-src/main/streams/plain_wrapper.c:1.52.2.6.2.24 --- php-src/main/streams/plain_wrapper.c:1.52.2.6.2.23 Wed Jul 25 16:34:05 2007 +++ php-src/main/streams/plain_wrapper.c Wed Oct 31 13:23:07 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: plain_wrapper.c,v 1.52.2.6.2.23 2007/07/25 16:34:05 dmitry Exp $ */ +/* $Id: plain_wrapper.c,v 1.52.2.6.2.24 2007/10/31 13:23:07 jani Exp $ */ #include "php.h" #include "php_globals.h" @@ -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 <stddef.h> #include <fcntl.h> #if HAVE_SYS_WAIT_H @@ -1032,12 +1033,10 @@ } 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 @@ return 0; } + /* Clear stat cache */ + php_clear_stat_cache(TSRMLS_C); + return 1; } @@ -1151,7 +1153,7 @@ } 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 @@ return 0; } + /* Clear stat cache */ + php_clear_stat_cache(TSRMLS_C); + return 1; } @@ -1412,9 +1417,6 @@ } /* }}} */ - - - /* * Local variables: * tab-width: 4 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/bug43137.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/file/bug43137.phpt +++ php-src/ext/standard/tests/file/bug43137.phpt --TEST-- Bug #43137 (rmdir() and rename() do not clear statcache) --FILE-- <?php $toname = "TO_" . md5(microtime()); $dirname = "FROM_" . md5(microtime()); mkdir($dirname); var_dump(is_dir($dirname)); // Expected: true rename($dirname, $toname); var_dump(is_dir($dirname)); // Expected: false var_dump(is_dir($toname)); // Expected: true rmdir($toname); var_dump(is_dir($toname)); // Expected: false ?> --EXPECT-- bool(true) bool(false) bool(true) bool(false)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php