|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-01-24 13:01 UTC] priebe at mi-corporation dot com
Under Apache 1.3.20 and PHP 4.1.1, register_shutdown_function() will run the specified function, but it will not close the connection to the client.
I have isolated the problem to sapi/apache/sapi_apache.c. In apache_php_module_main(), php_request_shutdown() is called. When called from this location, the connection is not shut down. However, if you comment this call out (along with the AP(in_request) = 0), it will be called from php_apache_request_shutdown() instead. When called from this function, php_request_shutdown() operates as expected.
I do not understand enough about why the changes were made from 4.0.x to 4.1.x. I also have not fully tested this change to see if there are undesirable side effects. I was hoping that someone more familiar with PHP internals would look at it and have an "A-HA" moment.
Here is a patch (hope this survives the cut-and-paste):
--- php-4.1.1/sapi/apache/sapi_apache.c Sat Aug 4 21:42:45 2001
+++ ../php-4.1.1-changed/php-4.1.1/sapi/apache/sapi_apache.c Thu Jan 24 12:08:40 2002
@@ -89,13 +89,13 @@
(void) php_execute_script(&file_handle TSRMLS_CC);
}
-
+/*
AP(in_request) = 0;
zend_try {
php_request_shutdown(NULL);
} zend_end_try();
-
+*/
return (OK);
}
/* }}} */
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 03:00:01 2025 UTC |
This bug still exists in 4.2.1 version. If it's reproduced 6/6 times on different platforms with an average score of 4.9, it's pretty important if not critical. Here's a sample script: <?PHP function foo () { sleep (10); print "foo<BR>\n"; } print "pre shutdown<BR>\n"; register_shutdown_function (foo); print "shutting down<BR>\n"; ?> This should return immediately printing pre shutdown shutting down but instead waits ten seconds then prints pre shutdown shutting down foo