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
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:
42 + 44 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 14:01:29 2024 UTC