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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
46 - 5 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 12:01:31 2024 UTC