ID: 34429 Comment by: pdxtechie at gmail dot com Reported By: zimage at icdsoft dot com Status: Open Bug Type: CGI related Operating System: * PHP Version: 5CVS, 4CVS (2005-09-12) New Comment:
This would also be useful for Ajax (using, for example, the RicoAjaxEngine.) If you are unable to disable buffering, there is no way to stream XML for progress updates through Ajax. Previous Comments: ------------------------------------------------------------------------ [2005-09-12 16:08:04] zimage at icdsoft dot com It could be also used for writing progress bars. On a random shared hosting server: locate .php |wc -l 25147 locate .php |xargs -n1 -i grep -H -e "flush *(" {} 641 So people are using it for some reason... I can see flush() used in Moveable Type, Word Press, MediaWiki and so on. ------------------------------------------------------------------------ [2005-09-12 15:49:27] [EMAIL PROTECTED] Writing such things using PHP is pretty useless IMO, but if it works with other SAPIs.. ------------------------------------------------------------------------ [2005-09-12 15:47:25] zimage at icdsoft dot com This is how you could write a chat client for example. Connection is kept open for the duration of chat session and php script is looping over the client and server messages. ------------------------------------------------------------------------ [2005-09-10 22:56:11] [EMAIL PROTECTED] How would it be useful to be able to turn it off? ------------------------------------------------------------------------ [2005-09-09 11:25:26] zimage at icdsoft dot com And strace of php process looks like: read(4, "<?php\n\tfor ($i=0; $i<4; $i++){\n\t"..., 8192) = 65 read(4, "", 4096) = 0 read(4, "", 8192) = 0 close(4) = 0 munmap(0x4056b000, 4096) = 0 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 nanosleep({1, 0}, {1, 0}) = 0 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 nanosleep({1, 0}, {1, 0}) = 0 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 nanosleep({1, 0}, {1, 0}) = 0 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 nanosleep({1, 0}, {1, 0}) = 0 setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={0, 0}}, NULL) = 0 write(3, "[EMAIL PROTECTED]: text/html\r"..., 96) = 96 I.e. there are 4 calls to sleep and the script output is writen at once. Any pointers to documentation or further tests that I should perform are welcome. ------------------------------------------------------------------------ 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 http://bugs.php.net/34429 -- Edit this bug report at http://bugs.php.net/?id=34429&edit=1