ID:               16048
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         Filesystem function related
 Operating System: Solaris 2.7 & 2.8
 PHP Version:      4.1.2
 New Comment:

I also tested this on Red Hat 7.2 with PHP 4.0.6  It works fine there.


Previous Comments:
------------------------------------------------------------------------

[2002-03-13 17:00:20] [EMAIL PROTECTED]

The fgets() function works differently when the input is a pipe. 
Specifically, feof() returns true after the first line is read.  The
test script and sample output follow.  The test script works fine if
stdin is redirected from a file.  It fails if stdin is a pipe.

Nothing special about the build:

./configure  --prefix=/usr/local --with-mysql

pjm@poseidon> cat test.php 
#!/usr/local/bin/php -q
<?php

$fd = fopen("php://stdin", "r");
while (! feof($fd))
{
        $buffer = fgets($fd, 4096);
        echo $buffer;
}

?>
pjm@poseidon> < test.php ./test.php 
#!/usr/local/bin/php -q
<?php

$fd = fopen("php://stdin", "r");
while (! feof($fd))
{
        $buffer = fgets($fd, 4096);
        echo $buffer;
}

?>
pjm@poseidon> cat test.php | ./test.php 
#!/usr/local/bin/php -q



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=16048&edit=1

Reply via email to