diff options
| author | Jani Taskinen <jani@php.net> | 2007-10-31 13:23:07 +0000 |
|---|---|---|
| committer | Jani Taskinen <jani@php.net> | 2007-10-31 13:23:07 +0000 |
| commit | bdbcc4b6d3372a5bb15fbafda831c325b859bc4e (patch) | |
| tree | 00250196b0c10ecc6ce0df6131dd343ab6082123 /ext | |
| parent | f4cd343b6c8be9469c21b7b822d4d3c858cf158f (diff) | |
| download | php-git-bdbcc4b6d3372a5bb15fbafda831c325b859bc4e.tar.gz | |
MFH: - Fixed Bug #43137 (rmdir() and rename() do not clear statcache)
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/openssl/openssl.c | 3 | ||||
| -rw-r--r-- | ext/standard/filestat.c | 21 | ||||
| -rw-r--r-- | ext/standard/php_filestat.h | 1 | ||||
| -rw-r--r-- | ext/standard/tests/file/005_basic.phpt | 2 | ||||
| -rw-r--r-- | ext/standard/tests/file/005_error.phpt | 2 | ||||
| -rw-r--r-- | ext/standard/tests/file/bug43137.phpt | 20 |
6 files changed, 40 insertions, 9 deletions
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 00dbd3f641..f6fa85ef59 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -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 diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index cfc364d2f4..3182237527 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -698,14 +698,10 @@ PHP_FUNCTION(touch) /* }}} */ #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 @@ PHP_FUNCTION(clearstatcache) } /* }}} */ +/* {{{ 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) diff --git a/ext/standard/php_filestat.h b/ext/standard/php_filestat.h index b0aae0a76c..f819b2bcbf 100644 --- a/ext/standard/php_filestat.h +++ b/ext/standard/php_filestat.h @@ -87,6 +87,7 @@ typedef unsigned int php_stat_len; 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: */ diff --git a/ext/standard/tests/file/005_basic.phpt b/ext/standard/tests/file/005_basic.phpt index 44a49d8cd0..5ed1118902 100644 --- a/ext/standard/tests/file/005_basic.phpt +++ b/ext/standard/tests/file/005_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -Test fileatime(),filemtime(),filectime() & touch() functions : basic functionality +Test fileatime(), filemtime(), filectime() & touch() functions : basic functionality --FILE-- <?php /* diff --git a/ext/standard/tests/file/005_error.phpt b/ext/standard/tests/file/005_error.phpt index f5eff91315..77fd4731c3 100644 --- a/ext/standard/tests/file/005_error.phpt +++ b/ext/standard/tests/file/005_error.phpt @@ -1,5 +1,5 @@ --TEST-- -Test fileatime(), filemtime(), filectime() & touch() functions: error conditions +Test fileatime(), filemtime(), filectime() & touch() functions : error conditions --FILE-- <?php /* diff --git a/ext/standard/tests/file/bug43137.phpt b/ext/standard/tests/file/bug43137.phpt new file mode 100644 index 0000000000..8125445bb0 --- /dev/null +++ b/ext/standard/tests/file/bug43137.phpt @@ -0,0 +1,20 @@ +--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) |
