summaryrefslogtreecommitdiff
path: root/main/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/main.c')
-rw-r--r--main/main.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/main/main.c b/main/main.c
index 5822cbfa21..d865027887 100644
--- a/main/main.c
+++ b/main/main.c
@@ -1564,8 +1564,16 @@ static void php_zend_stream_closer(void *handle) /* {{{ */
static size_t php_zend_stream_fsizer(void *handle) /* {{{ */
{
- php_stream_statbuf ssb;
- if (php_stream_stat((php_stream*)handle, &ssb) == 0) {
+ php_stream *stream = handle;
+ php_stream_statbuf ssb;
+
+ /* File size reported by stat() may be inaccurate if stream filters are used.
+ * TODO: Should stat() be generally disabled if filters are used? */
+ if (stream->readfilters.head) {
+ return 0;
+ }
+
+ if (php_stream_stat(stream, &ssb) == 0) {
return ssb.sb.st_size;
}
return 0;