|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-09-08 08:46 UTC] cmb@php.net
-Status: Open
+Status: Verified
-Type: Bug
+Type: Documentation Problem
-Assigned To:
+Assigned To: cmb
[2020-09-08 08:46 UTC] cmb@php.net
[2020-09-08 09:42 UTC] cmb@php.net
-Status: Verified
+Status: Closed
[2020-09-08 09:42 UTC] cmb@php.net
[2020-09-08 09:42 UTC] phpdocbot@php.net
[2020-09-08 11:50 UTC] phpdocbot@php.net
[2020-12-30 11:59 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 08:00:01 2025 UTC |
Description: ------------ When doing a stream_select(STDIN,null,null,0), then the return value will be 1 as soon as one switches the window focus or presses a meta key, but a subsequent fread(STDIN) will block. This is possible the same problem as #42044, which was closed as not a bug - however, I deem this behaviour as a bug as the select() is supposed to make sure a fread() will NOT block! Test script: --------------- public static function sleep($secs) { echo "sleeping $secs s"; for($i=0;$i<$secs;$i++) { $a=array(STDIN); $b=NULL; $num=stream_select($a,$b,$b,0); if($num>0) { //read and discard echo "fd '$num'\n"; echo "'".fread(STDIN,4096)."'"; break; } echo "\r".str_repeat(" ",60)."\r"; echo date("d.m.Y H:i:s") . " still sleeping for ".($secs-$i)." seconds"; sleep(1); } echo "done sleeping\n"; } Expected result: ---------------- The sleep counter is supposed to keep on counting in the background even if the commandline window is not focused. Actual result: -------------- The display will be e.g. "sleeping 20 sfd '1'" after focusing away.