php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16081 doesn't seem to honor fopen stdin position in code
Submitted: 2002-03-14 14:51 UTC Modified: 2002-04-15 00:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mlnog at mlong dot org Assigned:
Status: No Feedback Package: Output Control
PHP Version: 4.1.2 OS: tru64 5.0a
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-03-14 14:51 UTC] mlnog at mlong dot org
It appears that if I have a fopen to stdin anywhere in my code that PHP will prompt for stdin at the beginning of its execution instead of where I put it in the code.

The following example shows it:
#!/usr/local/bin/php
<?

print "BEFORE\n";
$cd=fopen("php://stdin","r");
$cd2=fread($cd,1);
print "AFTER\n";
?>

Now as soon as I execute it, it sits and waits for me to enter stdin, then prints
BEFORE
AFTER

It should be showing BEFORE and then prompt for STDIN, unless there is something major I am missing here.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-14 14:56 UTC] mfischer@php.net
Maybe it's your terminal buffering?

Have you tried with 'flush();' after your print statements?
 [2002-03-18 12:47 UTC] derek at web-solve dot net
I had the same problem running PHP 4.1.2 under RH 7.2, I downgraded to PHP 4.0.6 and everything was working correctly. The problem seems to be in 4.1.x
 [2002-04-15 00:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Dec 07 06:03:35 2021 UTC