|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-12-16 02:22 UTC] dward at maidencreek dot com
It seems that when a script terminates due to a
timeout connection_status() returns 0 (and
connection_timeout() no longer exists).
When aborted by a user connection_status() does return 1.
Sample script:
<?PHP
set_time_limit(1);
register_shutdown_function("shutdown");
function shutdown(){
$status = connection_status();
$err = "Connection status ($status).\n";
error_log($err, 3, "/tmp/phpstatus.log");
}
while(true){
echo ".";
}
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 17:00:01 2025 UTC |
The cause of the bug is that the following code is commented out in the timeout handler (zend_timeout() in zend_execute_API): /* is there any point in this? we're terminating the request anyway... PG(connection_status) |= PHP_CONNECTION_TIMEOUT; */ In our case, we need this error status to be set correctly. We want to be able to detect the error when a script is terminated due to timeout.This bug has been not fixed on win32. I've tried to execute this script <?PHP set_time_limit(1); register_shutdown_function("shutdown"); function shutdown(){ $status = connection_status(); $err = "Connection status ($status).\n"; error_log($err, 3, "/temp/phpstatus.log"); } while(true){ echo "."; } ?> PHP says: Fatal error: Maximum execution time of 1 second exceeded in C:\Inetpub\wwwroot\php\mynewsgate\shutdown.php on line 11 Fatal error: Maximum execution time of 1 second exceeded in C:\Inetpub\wwwroot\php\mynewsgate\shutdown.php on line 6 I've used PHP 4.3.2 on windows xpI concur -- this has NOT been fixed for Win32. Please (someone) fix. Need to be able to handle timeouts correctly. I used the following code under PHP 4.3.2 <? set_time_limit(1); function test() { echo connection_status(); echo "Processing timeout - line1\n"; echo "Processing timeout - line2\n"; } register_shutdown_function('test'); while(1); ?>