Bug #18022: fopen does not work with php://stdin anymore
| From: | monte at ispi dot net | Date: | Thu, 27 Jun 2002 18:51:08 +0000 |
| Subject: | Bug #18022: fopen does not work with php://stdin anymore | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-12258@lists.php.net to get a copy of this message | ||
From: monte@ispi.net
Operating system: Solaris 8 Sparc
PHP version: 4.2.1
PHP Bug Type: Filesystem function related
Bug description: fopen does not work with php://stdin anymore
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 bug report at http://bugs.php.net/?id=18022&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18022&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18022&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18022&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18022&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18022&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18022&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18022&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18022&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18022&r=globals