Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71507 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17641 invoked from network); 24 Jan 2014 15:07:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jan 2014 15:07:59 -0000 Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.215.10 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.215.10 mail.experimentalworks.net Received: from [217.114.215.10] ([217.114.215.10:44660] helo=mail.experimentalworks.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 16/F1-39789-EC182E25 for ; Fri, 24 Jan 2014 10:07:58 -0500 Received: from [192.168.2.31] (ppp-93-104-12-255.dynamic.mnet-online.de [93.104.12.255]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: johannes@schlueters.de) by mail.experimentalworks.net (Postfix) with ESMTPSA id 167AB3FEDB; Fri, 24 Jan 2014 16:08:30 +0100 (CET) To: Julien Pauli Cc: Sara Golemon , PHP internals In-Reply-To: References: <1390568541.2941.27.camel@guybrush> <1390572927.2941.37.camel@guybrush> Content-Type: text/plain; charset="UTF-8" Date: Fri, 24 Jan 2014 16:07:53 +0100 Message-ID: <1390576073.2941.50.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Module API Introspection From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) Hi, On Fri, 2014-01-24 at 15:29 +0100, Julien Pauli wrote: > > I don't have a better idea than something like a shell script doing > > `strings xdebug.so | grep API` -- which obviously is no good idea > > either, but maybe somebody is smarter than me. > > That's what we ended telling to attendees : we have no way in PHP > actually to check the API of an extension, except by trying to load > it. Trying to load it will actually tell the user *exactly* the same as this new option, it will either * load it successfully, * report PHP's and the extensions API numbers or * result in a symbol lookup error Contrary to the patch loading it will mind php.ini's extension dir. Right now php --modinfo=foo.so and php -m -dextension=foo.so will load different files (--modinfo's behavior can be seen as correct, but this difference is confusing) > However, GNU tools playing with ELF format are a global Unix solution > working, but not coming from PHP obviously. > > The only safe thing we could do, is wrapping libelf and play with it. > Somehow dirty and adds a new dependency :-p Another crazy idea I just had was along those lines: #define ZEND_GET_MODULE(name) \ BEGIN_EXTERN_C()\ ZEND_DLEXPORT zend_module_entry *get_module(void) { return &name##_module_entry; }\ + ZEND_DLEXPORT int this_extension_was_compiled_for_ ## PHP_VERSION() {return 1;} \ END_EXTERN_C() and then a shell script greping "this_extension_was_compiled_for" in the `ldd` output. This exact patch obviously won't work (PHP define in zend header, points in C function name, ...) but maybe somebody has more creativity for that. johannes