Bug #17193 Updated: calling getenv after register_shutdown causes apache to crash

From: Date: Thu, 11 Jul 2002 06:59:37 +0000
Subject: Bug #17193 Updated: calling getenv after register_shutdown causes apache to crash
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-13832@lists.php.net to get a copy of this message
ID: 17193 Updated by: sniper@php.net Reported By: jtate@php.net -Status: Open +Status: Closed Bug Type: Scripting Engine problem Operating System: RH Linux 7.2/Apach 1.3.22 PHP Version: 4.1.2/PHP_4_2_0 New Comment: If it doesn't happen with HEAD..why is this report still open? :) Previous Comments: ------------------------------------------------------------------------ [2002-05-14 16:37:33] jtate@php.net Doesn't seem to happen with HEAD. ------------------------------------------------------------------------ [2002-05-14 16:26:52] jtate@php.net 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. ------------------------------------------------------------------------ [2002-05-14 01:19:08] derick@php.net Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php Once you have generated a backtrace, please submit it to this bug report and change the status back to "Open". Thank you for helping us make PHP better. You can find ho wto make a backtrace on the location mentioned above. Derick ------------------------------------------------------------------------ [2002-05-13 19:25:57] 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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17193&edit=1

« previous php.bugs (#13832) next »