Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:4246 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32691 invoked by uid 1010); 29 Aug 2003 16:26:53 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 32629 invoked from network); 29 Aug 2003 16:26:52 -0000 Received: from unknown (HELO blobule.suds) (66.11.170.154) by pb1.pair.com with SMTP; 29 Aug 2003 16:26:52 -0000 Received: by blobule.suds (Postfix, from userid 501) id 153512F717; Fri, 29 Aug 2003 12:26:52 -0400 (EDT) To: Andrey Hristov Cc: internals@lists.php.net In-Reply-To: <001501c36e2f$db614890$1601a8c0@andreywin> References: <001501c36e2f$db614890$1601a8c0@andreywin> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8-3mdk Date: 29 Aug 2003 12:26:52 -0400 Message-ID: <1062174412.417.42.camel@blobule.suds> Mime-Version: 1.0 Subject: Re: [PHP-DEV] Shared module problems (core dumps) (under apache 1.3) From: robert@wocmud.org (Robert Cummings) The extension_loaded() function might serve you better than class_exists(). http://www.php.net/manual/en/function.extension-loaded.php Cheers, Rob. On Fri, 2003-08-29 at 09:17, Andrey Hristov wrote: > 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. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- .---------------------------------------------. | Worlds of Carnage - http://www.wocmud.org | :---------------------------------------------: | Come visit a world of myth and legend where | | fantastical creatures come to life and the | | stuff of nightmares grasp for your soul. | `---------------------------------------------'