|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-05-13 19:25 UTC] jtate@php.net
If you call register_shutdown_function, and then in the registered function make a call to getenv, Apache segfaults.
Here's a sample script:
<?PHP
function shutdowner()
{
$out = fopen("/tmp/env.out", "at");
fwrite($out, "getenv returned " . getenv("HOME") . "\n");
fclose($out);
}
echo "Getenv returned " . getenv("HOME") . "\n";
register_shutdown_function("shutdowner");
?>
Please note. This only happens when running as an apache module. CLI works fine, and I'd assume that CGI does too.
I'll post a back trace if some kind soul will explain how to do it under RH linux using the messed up !apachectl method that they use to start apache.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 28 19:00:02 2025 UTC |
Here's the back trace. Still happens with current 4_2_0 CVS. I'm checking HEAD right now. (gdb) bt #0 0x00000000 in ?? () #1 0x403d03d6 in apache_php_module_shutdown_wrapper () at mod_php4.c:795 #2 0x08051148 in run_cleanups (c=0x8107e04) at alloc.c:1713 #3 0x0804f681 in ap_clear_pool (a=0x80903d4) at alloc.c:538 #4 0x08062f70 in standalone_main (argc=1, argv=0xbfffea94) at http_main.c:5030 #5 0x08063b24 in main (argc=1, argv=0xbfffea94) at http_main.c:5417 #6 0x401af647 in __libc_start_main (main=0x8063640 <main>, argc=1, ubp_av=0xbfffea94, init=0x804e3f0 <_init>, fini=0x807c770 <_fini>, rtld_fini=0x4000dcd4 <_dl_fini>, stack_end=0xbfffea8c) at ../sysdeps/generic/libc-start.c:129 It looks like register_shutdown_function is no longer performing as it has in the past. I'll follow up this in another bug report.