|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45928 large scripts from stdin are stripped at 16K border
Submitted: 2008-08-26 18:24 UTC Modified: 2008-09-10 10:31 UTC
From: Assigned:
Status: Closed Package: CGI/CLI related
PHP Version: 5.3CVS-2008-08-26 (CVS) OS: Mac OS X 10.5
Private report: No CVE-ID: None
 [2008-08-26 18:24 UTC]


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-09 12:00 UTC] cschneid at cschneid dot com
I had a quick look at this bug and found the problem to be in Zend/zend_stream.c function zend_stream_fsize(): It uses fstat() to determine the filesize which on MacOS X for pipes returns either 0 (my interpretation: no data from the pipe ready yet) or a number up to 16384 (my interpretation: data from the pipe ready but the maximum buffer size is 16k).

I see several solutions but I'm not sure which is the desired one:
- return 0 (size unknown) if the file is a pipe (or socket, ...)
- return 0 if the file is not a regular file (or symlink, dir?)
- look into a way of determining EOF reached

As a quick test I changed
	return buf.st_size;
in function zend_stream_fsize() to
	return 0;
and cat 30k.php | php worked after that.

I posted this to but did not get any reply so I'm not sure how to proceed.
 [2008-09-10 10:31 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC