ID: 48475
Updated by: pajoye@php.net
Reported By: cagret at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: Apache2 related
Operating System: win32 only - Win XP SP3
PHP Version: 5.2.9
New Comment:
I'm not sure it is windows specific. What's about Linux+Apache+php5 as
mod?
Previous Comments:
------------------------------------------------------------------------
[2009-06-15 08:38:37] jani@php.net
And as it only happens with windows, it's a bug that needs to be fixed:
exit() should exit there too.
------------------------------------------------------------------------
[2009-06-10 19:36:52] cagret at gmail dot com
I have installed php as fcgi under lighttpd on windows, and
register_shutdown_function() is called after exit - all versions of php.
The same under linux - I have tested many more configurations.
It seems that only under Apache on windows,
register_shutdown_function() is not executed.
If this is expected behavior, than why it acts differently on different
setups? Something is wrong.
In manual it is said, that after exit() called inside function
registered by register_shutdown_function() nothing more will be
executed, but here exit() is called outside of registered function.
In comments on http://www.php.net/register_shutdown_function
there are
code examples that show that even after exit() that is not called inside
registered shutdown function, the registered function IS executed -
people think the other way about the expected behaviour.
And if this is expected behavior, it works as expected only on Windows
Apache and php5 as php_mod.
I've made another test, Win + Apache + php5 as fcgi - and the file
shutdown.txt is created after exit().
Summary:
I've tested over 10 configurations, Windows, Linux, Apache, Lightpd,
php4, php5, php as cgi, php as mod - the only configuration that does
not execute register_shutdown_function() after exit (that is called
outside of registered function) is: Win + Apache + php5 as mod.
I don't think this is expected behavior, because it behaves as expected
only on this configuration: Win+Apache+php5_as_mod.Please reconsider
re-opening this issue.
Configurations summary:
Win+Apache+php5 as cgi - shutdown.txt is created
Win+Apache+php4 as mod - shutdown.txt is created
Win+Lighttpd+php5 as fcgi - shutdown.txt is created
Linux+Apache+php4 as mod - shutdown.txt is created
Linux+Lighttpd+php5 as fcgi - shutdown.txt is created
Win+Apache+php5 as mod - shutdown.txt IS NOT created.
------------------------------------------------------------------------
[2009-06-10 12:59:18] jani@php.net
Expected behaviour. exit() is supposed to exit immediately. Nothing is
supposed to be run after you call exit.
------------------------------------------------------------------------
[2009-06-05 02:41:52] cagret at gmail dot com
Description:
------------
Function registered with register_shutdown_function() is not executed
after call to exit() on windows with latest php (php5 - failed, php4 -
ok). On linux it works as expected (both php4 & php5 - ok).
I have tested many configurations, here is the summary:
* Win XP Sp3, Apache/2.2.11 php_mod, php versions: 5.2.9-2, 5.2.6,
5.2.8, 5.2.10RC1, 5.3.0RC2 (all versions FAILED)
* Win XP Sp3, Apache/1.3.34, php_mod, php 4.4.3-dev (OK)
* Linux, Lighttpd, cgi-fcgi, php 5.2.6 (OK)
* Linux, Apache/2.0.52 (CentOS), php_mod, php 4.3.9 (OK)
Reproduce code:
---------------
<?php
function shutdown()
{
file_put_contents(dirname(__FILE__).'/shutdown.txt', time());
}
register_shutdown_function('shutdown');
exit();
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48475&edit=1