diff options
author | Stanislav Malyshev <stas@php.net> | 2014-04-20 15:27:55 -0700 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2014-04-20 15:27:55 -0700 |
commit | dd9c80e44bdd43ffcdc3f031ac9537d7940b76ea (patch) | |
tree | ca82c3c1037215111dd8da3d7e0b5f427e0e300d /main/streams/streams.c | |
parent | 0cdc57b3cf6b63466cf6c612ce7ef4598236926d (diff) | |
parent | 774f16318b3739e751d5a041f3601a3cf3000614 (diff) | |
download | php-git-dd9c80e44bdd43ffcdc3f031ac9537d7940b76ea.tar.gz |
Merge branch 'PHP-5.6'
* PHP-5.6:
Fix bug #65701: Do not use cache for file file copy
Diffstat (limited to 'main/streams/streams.c')
-rw-r--r-- | main/streams/streams.c | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/main/streams/streams.c b/main/streams/streams.c index c7ff1210a8..6716dce524 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -1924,16 +1924,18 @@ PHPAPI int _php_stream_stat_path(const char *path, int flags, php_stream_statbuf const char *path_to_open = path; int ret; - /* Try to hit the cache first */ - if (flags & PHP_STREAM_URL_STAT_LINK) { - if (BG(CurrentLStatFile) && strcmp(path, BG(CurrentLStatFile)) == 0) { - memcpy(ssb, &BG(lssb), sizeof(php_stream_statbuf)); - return 0; - } - } else { - if (BG(CurrentStatFile) && strcmp(path, BG(CurrentStatFile)) == 0) { - memcpy(ssb, &BG(ssb), sizeof(php_stream_statbuf)); - return 0; + if (!(flags & PHP_STREAM_URL_STAT_NOCACHE)) { + /* Try to hit the cache first */ + if (flags & PHP_STREAM_URL_STAT_LINK) { + if (BG(CurrentLStatFile) && strcmp(path, BG(CurrentLStatFile)) == 0) { + memcpy(ssb, &BG(lssb), sizeof(php_stream_statbuf)); + return 0; + } + } else { + if (BG(CurrentStatFile) && strcmp(path, BG(CurrentStatFile)) == 0) { + memcpy(ssb, &BG(ssb), sizeof(php_stream_statbuf)); + return 0; + } } } @@ -1941,19 +1943,21 @@ PHPAPI int _php_stream_stat_path(const char *path, int flags, php_stream_statbuf if (wrapper && wrapper->wops->url_stat) { ret = wrapper->wops->url_stat(wrapper, path_to_open, flags, ssb, context TSRMLS_CC); if (ret == 0) { - /* Drop into cache */ - if (flags & PHP_STREAM_URL_STAT_LINK) { - if (BG(CurrentLStatFile)) { - efree(BG(CurrentLStatFile)); - } - BG(CurrentLStatFile) = estrdup(path); - memcpy(&BG(lssb), ssb, sizeof(php_stream_statbuf)); - } else { - if (BG(CurrentStatFile)) { - efree(BG(CurrentStatFile)); + if (!(flags & PHP_STREAM_URL_STAT_NOCACHE)) { + /* Drop into cache */ + if (flags & PHP_STREAM_URL_STAT_LINK) { + if (BG(CurrentLStatFile)) { + efree(BG(CurrentLStatFile)); + } + BG(CurrentLStatFile) = estrdup(path); + memcpy(&BG(lssb), ssb, sizeof(php_stream_statbuf)); + } else { + if (BG(CurrentStatFile)) { + efree(BG(CurrentStatFile)); + } + BG(CurrentStatFile) = estrdup(path); + memcpy(&BG(ssb), ssb, sizeof(php_stream_statbuf)); } - BG(CurrentStatFile) = estrdup(path); - memcpy(&BG(ssb), ssb, sizeof(php_stream_statbuf)); } } return ret; |