Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:4242 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37482 invoked by uid 1010); 29 Aug 2003 13:17:02 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 37447 invoked from network); 29 Aug 2003 13:17:02 -0000 Received: from unknown (HELO jedi.webgate.bg) (212.50.2.189) by pb1.pair.com with SMTP; 29 Aug 2003 13:17:02 -0000 Received: (qmail 11700 invoked from network); 29 Aug 2003 13:15:20 -0000 Received: from nik.office.webgate.bg (HELO andreywin) (192.168.1.22) by jedi.webgate.bg with SMTP; 29 Aug 2003 13:15:20 -0000 Message-ID: <001501c36e2f$db614890$1601a8c0@andreywin> To: Date: Fri, 29 Aug 2003 16:17:11 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Subject: Shared module problems (core dumps) (under apache 1.3) From: andrey@php.net ("Andrey Hristov") Hi, till today I had a big problem with my Apache 1.3 segfaulting when I try to instantiate from a class. The class is declared in a C extesion (named xml_parser.so, class name WebgateXMLParser). Few week after the implementation it worked well since I just loaded the extension with dl() : dl('xml_parser.so'). At some point I decided to include a check whether the module is loaded (compiled statically) and in this case not to dl() it. Just around the time I implemented (in PHP) this check my Apache/PHP started to core. Sadly I found the reason just today. My check is this : if (!class_exists('WebgateXmlParser')) { // if it's built into the PHP binary don't load dl('xml_parser.so'); }// if What happens? After the request is finished the module is unloaded - this can easily be seen just by doing a var_dump(get_loaded_extensions()); before the "if". However PHP/Zend still thinks that there is WebgateXmlParser class. Briefly : Zend DOES NOT unregister classes on module unload. Now you may imagine what happens when the extension is not loaded since Zend Engine thinks that the class exists (but it does not) and the code tries to instantiate an object of the class - core dump. IMO IT IS a bug that the class entries are not unregistered when the module is unloaded after the request. I have not tried this but the same error may apply to functions exported by a C extension and thus leading to the same effect - crashes that are hard to explain. Regards, Andrey P.S. Yes, there is a workaround for my case : to check whether the module is loaded but not checking whether the class exists.