Edit report at https://bugs.php.net/bug.php?id=47918&edit=1
ID: 47918 Comment by: schmod at gmail dot com Reported by: RQuadling at GMail dot com Summary: stream_set_blocking() does not work with pipes opened with proc_open() Status: Open Type: Bug Package: Streams related Operating System: Windows PHP Version: 5.*, 6CVS (2009-06-19 Block user comment: N Private report: N New Comment: Is this really true? I can run a number of console applications via proc_open() without encountering blocking on win32. However, I have encountered a number of applications that will cause PHP hang on fread() until the process closes (regardless of whether or not the buffer has filled). This needs to either be categorized as a bug, or the documentation needs to be updated to explain this unexpected behavior on win32. PHP 5.4.3/Win7x64. Previous Comments: ------------------------------------------------------------------------ [2009-08-24 08:59:40] RQuadling at GMail dot com Essentially, non-blocking streams don't exist in win32 PHP. They work fine for non-win32, so maybe this should become a feature request. >From reading the MSDN sites regarding non-blocking/blocking, it seems that a completely different mechanism for file handling needs to be used. Other scripting languages have solved this issue in a different fashion, using an additional thread to process the stream. ------------------------------------------------------------------------ [2009-08-22 05:51:48] nobodyy at mailinator dot com Same problem here... If we use proc_open and the output (pipes[1]) is greater than 2kb, the application just gets stuck! I don't have any idea why, but it is never terminated, unless we do an FREAD of FGETS at the pipe[1]. But we can't do the FGETS if we don't know if there is content to be read. There is when stream_set_blocking should save the day.. But it doesn't work! :( ------------------------------------------------------------------------ [2009-07-28 09:47:05] morrisdavidd at gmail dot com I tested this on PHP 5.3 (on Linux) and duplicated the error that the print_r command shows blocking as true. HOWEVER, the stream does not block when actually tested... a simple test script can be created by adding a line and slightly modifying the scripts found at: http://bugs.php.net/bug.php?id=49084 ------------------------------------------------------------------------ [2009-06-19 11:12:34] j...@php.net If it exists below 5.3, the version must state it! Do NOT touch it again. ------------------------------------------------------------------------ [2009-06-19 09:31:34] RQuadling at GMail dot com Only worry about 5.3+ ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=47918 -- Edit this bug report at https://bugs.php.net/bug.php?id=47918&edit=1