]> granicus.if.org Git - php/commitdiff
Fixed #45928 (large scripts from stdin are stripped at 16K border)
authorArnaud Le Blanc <lbarnaud@php.net>
Wed, 10 Sep 2008 10:15:58 +0000 (10:15 +0000)
committerArnaud Le Blanc <lbarnaud@php.net>
Wed, 10 Sep 2008 10:15:58 +0000 (10:15 +0000)
Zend/zend_stream.c

index a514751b310540d0686b4d3b934151c80609d84f..1998aa84184d963b47ab40a3a7401c46a9b7f926 100644 (file)
@@ -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;
        }