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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mlnog at mlong dot org
New email:
PHP Version: OS:

 

 [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

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: Sun Sep 08 22:01:28 2024 UTC