#18022 [Fbk]: fopen does not work with php://stdin anymore

From: Date: Sat, 24 Aug 2002 09:55:38 +0000
Subject: #18022 [Fbk]: fopen does not work with php://stdin anymore
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-17754@lists.php.net to get a copy of this message
ID: 18022 Updated by: wez@php.net Reported By: monte@ispi.net Status: Feedback Bug Type: Filesystem function related Operating System: Solaris 8 Sparc PHP Version: 4.2.1 New Comment: Could you check main/php_config.h and see if HAVE_FLUSHIO is defined? I think that might be the cause of the problem (and that this will also be reproduceable with streams in HEAD). Previous Comments: ------------------------------------------------------------------------ [2002-08-23 22:05:52] sniper@php.net Nevermind..I should have read the report twice before replying. The first script works fine for me when using PHP 4.3.0-dev (CLI). Can you please try it yourself too? http://snaps.php.net/php4-latest.tar.gz ------------------------------------------------------------------------ [2002-08-23 22:03:14] sniper@php.net The other report didn't get any feedback so I'm opening this one. Seems to be real problem, at least I couldn't get neither of these scripts to work.. (or I misunderstood what I shoud pass them? :) ------------------------------------------------------------------------ [2002-07-01 15:15:33] sander@php.net Dupe of #16048 ------------------------------------------------------------------------ [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

« previous php.bugs (#17754) next »