#48475 [Opn-Bgs]: register_shutdown_function() does not execute after exit()

2009-06-16 Thread cagret at gmail dot com
 ID:   48475
 User updated by:  cagret at gmail dot com
 Reported By:  cagret at gmail dot com
-Status:   Open
+Status:   Bogus
 Bug Type: Apache2 related
 Operating System: win32 only - Win XP SP3
 PHP Version:  5.2.9
 New Comment:

Sorry, this is not a bug, I've found what was the problem, on Windows I
had in php.ini directive auto_prepend_file which included
auto_prepend.php and that file registered shutdown function
debug_console() which had exit() inside!


Previous Comments:


[2009-06-16 04:46:12] cagret at gmail dot com

I've just tested:
Linux + Apache2 + php 5.2.9 as mod: shutdown.txt IS created.
(http://testreg.netii.net/phpinfo.php)



[2009-06-15 08:41:09] paj...@php.net

I'm not sure it is windows specific. What's about Linux+Apache+php5 as
mod?



[2009-06-15 08:38:37] j...@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] j...@php.net

Expected behaviour. exit() is supposed to exit immediately. Nothing is

supposed to be run after you call exit.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/48475

-- 
Edit this bug report at http://bugs.php.net/?id=48475edit=1



#48475 [Opn-Bgs]: register_shutdown_function() does not execute after exit()

2009-06-10 Thread jani
 ID:   48475
 Updated by:   j...@php.net
 Reported By:  cagret at gmail dot com
-Status:   Open
+Status:   Bogus
 Bug Type: *General Issues
 Operating System: Win XP SP3
 PHP Version:  5.2.9
 New Comment:

Expected behaviour. exit() is supposed to exit immediately. Nothing is

supposed to be run after you call exit.


Previous Comments:


[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=48475edit=1