From: matteosistisette at gmail dot com Operating system: Linux PHP version: 5.3.24 Package: *General Issues Bug Type: Bug Bug description:Client-side abortion is not detected at all
Description: ------------ PHP Version 5.3.3-7+squeeze14 (for some reason it is not in the dropdown) I have read and deeply understood these: http://www.php.net/manual/en/features.connection-handling.php http://www.php.net/manual/en/function.register-shutdown-function.php However, neither in 5.1.6 nor in 5.3.3 do things work even close to described there: - connection_status() always return true, even after the client has closed the connection. - execution of the script keeps going on after the client has closed the connection, even though ignore_user_abort is 0 - a function registered with register_shutdown_function() is not run until the script reaches ends. The script is NOT interrupted (and hence the function not called) when the client aborts the connection. So basically PHP just doesn't detect the client's disconnection AT ALL. Note that this is NOT as if ignore_user_abort was set to 1: if that was the case then connection_status() would return 1 even though the script would keep running and the shutdown function would not be called until the end. That is not the case. ini_get("ignore_user_abort") returns 0, as expected. I'm observing this both on PHP 5.1.6 on CentOS 5.9, and on PHP 5.3 on Debian 6.0.3 Steps to reproduce: - put the script below in the public_html folder - tail -f /path/to/error_log - visit the url of the php script from a browser or client - hit the stop button in the browser or abort connection from the client - watch the error_log Test script: --------------- <?php function myShutdown() { error_log("myShutdown ".connection_status()." ".ini_get("ignore_user_abort")); } register_shutdown_function(myShutdown); echo "Hi!"; error_log(" *** test/test *** "); for ($i=0; $i<10; $i++) { sleep(1); error_log("."); echo "."; } ?> Expected result: ---------------- Expected: at the moment when the client abort connection, you should stop seeing new "." in the log, and you should see immediately: myShutdown 1 0 Actual result: -------------- Observed: Exactly 10 dots (".") appear one at every second, even if the client aborts connection before the 10th dot is reached, and only at the end you see "myShutdown 0 0" This differs with the documented behavior. Everything consistently behaves as if connection from the client was NEVER aborted. -- Edit bug report at https://bugs.php.net/bug.php?id=64644&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64644&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64644&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64644&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64644&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64644&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64644&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64644&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64644&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64644&r=support Expected behavior: https://bugs.php.net/fix.php?id=64644&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64644&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64644&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64644&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64644&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64644&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64644&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64644&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64644&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64644&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64644&r=mysqlcfg