Bug #18022 Updated: fopen does not work with php://stdin anymore
| From: | sander@php.net | Date: | Mon, 01 Jul 2002 19:15:33 +0000 |
| Subject: | Bug #18022 Updated: fopen does not work with php://stdin anymore | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-12691@lists.php.net to get a copy of this message | ||
ID: 18022
Updated by: sander@php.net
Reported By: monte@ispi.net
-Status: Open
+Status: Duplicate
Bug Type: Filesystem function related
Operating System: Solaris 8 Sparc
PHP Version: 4.2.1
New Comment:
Dupe of #16048
Previous Comments:
------------------------------------------------------------------------
[2002-06-27 14:51:07] monte@ispi.net
This used to work in PHP 4.0.6:
cat test.txt| php -q stdin.php
DEBUG: I have line one
DEBUG: I have line two
DEBUG: I have line three
DEBUG: I have line four
DEBUG: I have line five
DEBUG: I have line six
DEBUG: done
stdin.php
---------
<?php
$fp = fopen('php://stdin','r');
while(!feof($fp)) {
$line = fgets($fp,4096);
echo "DEBUG: I have line $line";
}
fclose($fp);
echo "DEBUG: done\n";
?>
Now in PHP 4.2.1, it does not work, it only prints the first line of
the input. I tried setting allow_url_fopen = On but that did not make a
difference.
This DOES work however:
<?php
$fp = popen('cat /dev/fd/0','r');
while(!feof($fp)) {
$line = fgets($fp,4096);
echo "DEBUG: I have line $line";
}
pclose($fp);
echo "DEBUG: done\n";
?>
Here is a entry from the mailing list that may be of help.
http://marc.theaimsgroup.com/?l=php-general&m=101428004729977&w=2
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18022&edit=1