PHP 4.0 Bug #4581: connection_status not updated in cgi

From: Date: Wed, 24 May 2000 17:50:27 +0000
Subject: PHP 4.0 Bug #4581: connection_status not updated in cgi
Groups: php.dev 
Request: Send a blank email to php-dev+get-19395@lists.php.net to get a copy of this message
From: daniel.braun@ercom.fr Operating system: Solaris 2.6 PHP version: 4.0 Release Candidate 1 PHP Bug Type: Other Bug description: connection_status not updated in cgi 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

« previous php.dev (#19395) next »