|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-05-30 19:24 UTC] rasmus at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 16 17:00:02 2025 UTC |
In file sapi/apache/mod_php4.c, function sapi_apache_ub_write() check return code of fwrite, and set connection_status accordingly But in sapi/cgi/cgi_main.c, the equivalent function sapi_cgibin_ub_write() does not check the return code. Indeed, in the cgi version I dont see where connection_status is set to PHP_CONNECTION_ABORTED. As a result, I have a script that never end, although IgnoreUserAbort is set to Off, and connection_status() still returns 0 though client is dead. Changing in cgi_main.c .._ub_write() to : static int sapi_cgibin_ub_write(const char *str, uint str_length) { int ret; ret=fwrite(str, 1, str_length, stdout); if (ret != str_length) { PG(connection_status) = PHP_CONNECTION_ABORTED; if (!PG(ignore_user_abort)) { zend_bailout(); } } return ret; } does not solve my problem, because error (and ignored SIGPIPE) occurs in fflush(), not in fwrite() so I had to change sapi_cgibin_flush() too. static void sapi_cgibin_flush(void *server_context) { if (fflush(stdout) <0) { PG(connection_status) = PHP_CONNECTION_ABORTED; if (!PG(ignore_user_abort)) { zend_bailout(); } } } hope this helps