php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22837 stream_set_timeout() does not work on stdin
Submitted: 2003-03-24 00:59 UTC Modified: 2003-03-24 06:29 UTC
Votes:3
Avg. Score:4.0 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: gavin at itmerge dot com Assigned:
Status: Wont fix Package: Filesystem function related
PHP Version: 4.3.1 OS: Linux Kernel 2.4.18
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gavin at itmerge dot com
New email:
PHP Version: OS:

 

 [2003-03-24 00:59 UTC] gavin at itmerge dot com
/* in php 4.3 with the CLI interface
STDIN is predefined */

$auth=0;
stream_set_timeout(STDIN,61);
$time=time();
while ($auth==0 && time()<$time+60) {
  while(!feof(STDIN) && $auth==0 && time()<$time+60) {
    $test=fgets(STDIN,1024);

 }
}
if (time()>=$time+60) echo "You have timedout\n";
/* I never get to the above line 
because It sits there at fgets never timing out.
i've tried 
set_time_limit(60) and ini_set("max_execution_time",60)
but nothing will stop the script from executing.
i'm running this script thru tcpd
if it gets stuck waiting for input i have to manually kill
all the processes, gets very very icky. :(
btw. i've also tried $stdin=fopen("php://stdin","r");
stream_set_timeout($stdin,61);
ps. i know it's new :), i know it says "potentially"
*/


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-24 06:29 UTC] wez@php.net
This wont be fixed in 4.3.x; you can use stream_select() instead.
PHP5 will have better general support for stream_set_timeout().

 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC