From: Arnaud Le Blanc Date: Wed, 10 Sep 2008 10:15:58 +0000 (+0000) Subject: Fixed #45928 (large scripts from stdin are stripped at 16K border) X-Git-Tag: BEFORE_HEAD_NS_CHANGE~448 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=470a396f656f4c8c753c272e516b1ac0774f0122;p=php Fixed #45928 (large scripts from stdin are stripped at 16K border) --- diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c index a514751b31..1998aa8418 100644 --- a/Zend/zend_stream.c +++ b/Zend/zend_stream.c @@ -51,6 +51,11 @@ static size_t zend_stream_stdio_fsizer(void *handle TSRMLS_DC) /* {{{ */ { struct stat buf; if (handle && fstat(fileno((FILE*)handle), &buf) == 0) { +#ifdef S_ISREG + if (!S_ISREG(buf.st_mode)) { + return 0; + } +#endif return buf.st_size; } return 0; @@ -96,6 +101,11 @@ static size_t zend_stream_fsize(zend_file_handle *file_handle TSRMLS_DC) /* {{{ return file_handle->handle.stream.fsizer(file_handle->handle.stream.handle TSRMLS_CC); } if (file_handle->handle.fp && fstat(fileno(file_handle->handle.fp), &buf) == 0) { +#ifdef S_ISREG + if (!S_ISREG(buf.st_mode)) { + return 0; + } +#endif return buf.st_size; }