Re: Opinion needed (bug #45928)

From: Date: Tue, 09 Sep 2008 14:51:54 +0000
Subject: Re: Opinion needed (bug #45928)
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-40410@lists.php.net to get a copy of this message
Hi, On Tuesday 09 September 2008 14:39:05 Alexey Zakhlestin wrote: > http://bugs.php.net/bug.php?id=45928 > > Christian Schneider wrote: > > > 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. > > It seems to be a good solution. zend_stream seems to already rely on size == 0 for non-regular files and falls back to something like "while (!feof){ read }" in that case. The following may (no MacOS X to test) fix the problem by returning 0 from zend_stream_fsize() when the file descriptor is not a regular file: http://arnaud.lb.s3.amazonaws.com/45928.patch Regards, Arnaud

« previous php.internals (#40410) next »