From: php at alterego dot dp dot ua Operating system: Any PHP version: 5.2.5RC2 PHP Bug Type: Apache related Bug description: connection_status() CAN function properly without output
Description: ------------ Please regard this comment seriously, it really contains information on how to fix 25266, 22072, 30301 and many other (NOT bogus) bugs under Apache SAPI. >From bug 25266 comment by [EMAIL PROTECTED]: > Apache provides a way for PHP to detect if connection was > aborted ONLY and ONLY when PHP is either reading data from > the user or writing back data. That is not true. This link contains description and code (mod_perl) on how to detect disconnection without flushing data: http://www.webreference.com/programming/perl/cookbook/chap4/5.html My untidy but WORKING solution was to add code given below to sapi_apache_flush function and call flush() function before connection_aborted() checks WITHOUT any output. Of course, it would be perfectly logical to add it to connection_aborted function itself, but I could not find any way to call SAPI-specific function from core. Working code is: int fd; struct timeval tv = {0,0}; fd_set set; if (server_context) { request_rec *r = SG(server_context); fd = ap_bfileno(r->connection->client, B_WR); if (fd >= 0) { FD_ZERO(&set); FD_SET(fd, &set); if (select(fd + 1, &set, NULL, NULL, &tv) >= 0 && FD_ISSET(fd, &set)) { php_handle_aborted_connection(); } } } -- Edit bug report at http://bugs.php.net/?id=43219&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43219&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43219&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43219&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43219&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43219&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43219&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43219&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43219&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43219&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43219&r=support Expected behavior: http://bugs.php.net/fix.php?id=43219&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43219&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43219&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43219&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43219&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43219&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43219&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43219&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43219&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43219&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43219&r=mysqlcfg