#45928 [Ctl->Csd]: large scripts from stdin are stripped at 16K border

From: Date: Wed, 10 Sep 2008 10:31:22 +0000
Subject: #45928 [Ctl->Csd]: large scripts from stdin are stripped at 16K border
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-128837@lists.php.net to get a copy of this message
ID: 45928 Updated by: lbarnaud@php.net Reported By: indeyets@php.net -Status: Critical +Status: Closed Bug Type: CGI related Operating System: Mac OS X 10.5 PHP Version: 5.3CVS-2008-08-26 (CVS) New Comment: 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 http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2008-09-09 12:00:55] 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 internals@php.net but did not get any reply so I'm not sure how to proceed. ------------------------------------------------------------------------ [2008-08-26 18:24:52] indeyets@php.net Description: ------------ any php-file which is larger that 16Kb will result in parse error on Mac OS X, if run as following: cat largefile.php|php -l while the following options will work: php -l largefile.php php -l < largefile.php "-l" flag is optional. it can be reproduced without it too I discussed this with Rasmus (he was able to reproduce this problem too), and he mentioned, that this bug is most likely re2c-related Expected result: ---------------- No syntax errors detected in - Actual result: -------------- PHP Parse error: syntax error, unexpected $end in … ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45928&edit=1

« previous php.bugs (#128837) next »