From: Arnaud Le Blanc Date: Wed, 10 Sep 2008 10:28:39 +0000 (+0000) Subject: MFH: Fixed #45928 (large scripts from stdin are stripped at 16K border) X-Git-Tag: BEFORE_NS_RULES_CHANGE~434 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ffb76017d50930c1238f60c15216c3ccac31253d;p=php MFH: Fixed #45928 (large scripts from stdin are stripped at 16K border) --- diff --git a/Zend/zend_stream.c b/Zend/zend_stream.c index 068b30ed87..a67fcdab1f 100644 --- a/Zend/zend_stream.c +++ b/Zend/zend_stream.c @@ -49,6 +49,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; @@ -93,6 +98,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; }