From:             gavin at itmerge dot com
Operating system: Linux Kernel 2.4.18
PHP version:      4.3.1
PHP Bug Type:     Filesystem function related
Bug description:  stream_set_timeout() does not work on stdin

/* 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"
*/


-- 
Edit bug report at http://bugs.php.net/?id=22837&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22837&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22837&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22837&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22837&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22837&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22837&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22837&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22837&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22837&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22837&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22837&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22837&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22837&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22837&r=gnused

Reply via email to