diff options
author | Stanislav Malyshev <stas@php.net> | 2014-04-20 15:24:14 -0700 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2014-04-20 15:25:03 -0700 |
commit | 5addf223d597c56638a34f9ef0061d454e748abe (patch) | |
tree | 3b3f22c500daa01ba097f8083c4b41c636bff008 /main/streams | |
parent | 3586d14b61fbf3932650899d99a09e25784cf587 (diff) | |
parent | a18cec1b865994735e5b4ab757ccc1a14f8607ff (diff) | |
download | php-git-5addf223d597c56638a34f9ef0061d454e748abe.tar.gz |
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
Fix bug #65701: Do not use cache for file file copy
Diffstat (limited to 'main/streams')
-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 afd2d0a7e1..53e37ebe3b 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -1924,16 +1924,18 @@ PHPAPI int _php_stream_stat_path(char *path, int flags, php_stream_statbuf *ssb, 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(char *path, int flags, php_stream_statbuf *ssb, 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; |