Re: PHP 4.0 Bug #4581: connection_status not updated in cgi

From: Date: Thu, 25 May 2000 08:07:48 +0000
Subject: Re: PHP 4.0 Bug #4581: connection_status not updated in cgi
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-19422@lists.php.net to get a copy of this message
On Wed, May 24, 2000 at 05:50:27PM -0000, daniel.braun@ercom.fr wrote: > 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 fixed in CVS. thanx! > > 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 > > > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!" Digital Collections Phone +49 40 235350 Fax +49 40 23535180 Hammerbrookstr. 93 20097 Hamburg / Germany

« previous php.dev (#19422) next »