Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:30246 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76088 invoked by uid 1010); 19 Jun 2007 09:03:51 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 76073 invoked from network); 19 Jun 2007 09:03:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jun 2007 09:03:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=francois.laupretre@ratp.fr; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=francois.laupretre@ratp.fr; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ratp.fr from 81.255.174.9 cause and error) X-PHP-List-Original-Sender: francois.laupretre@ratp.fr X-Host-Fingerprint: 81.255.174.9 unknown Solaris 8 (2) Received: from [81.255.174.9] ([81.255.174.9:19802] helo=odii-smtp.ratp.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1A/B4-39378-5FB97764 for ; Tue, 19 Jun 2007 05:03:50 -0400 Received: from bl03ic06.info.ratp (unknown [188.20.209.10]) by odii-smtp.ratp.fr (Postfix) with ESMTP id 185D711F841; Tue, 19 Jun 2007 11:03:45 +0200 (MEST) Received: from EXCHANGE04.info.ratp ([188.20.209.6]) by bl03ic06.info.ratp with Microsoft SMTPSVC(6.0.3790.2499); Tue, 19 Jun 2007 11:02:44 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Tue, 19 Jun 2007 10:58:24 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: RE : Feature(let) idea Thread-Index: AceyTRj6DIRTUTZgQFi/+Zp2f+YHzAAAGhPC References: <698DE66518E7CA45812BD18E807866CE49E7BF@us-ex1.zend.net> <46777CFB.8080707@e-novative.de> <46779579.9020206@e-novative.de> To: "Stefan Priebsch" , "Pierre" Cc: "Andi Gutmans" , X-OriginalArrivalTime: 19 Jun 2007 09:02:44.0351 (UTC) FILETIME=[995D60F0:01C7B250] Subject: RE : Feature(let) idea From: francois.laupretre@ratp.fr (=?iso-8859-1?Q?LAUPRETRE_Fran=E7ois_=28P=29?=) > The idea is to use the same set of "extension=3Dfoo" directives for = all > platforms (nearly all). It is relatively obvious that extension_dir > will differ. IMHO, it should also allow to dl() by extension name, but only as a = fallback mechanism to keep BC.=20 First consider the argument as a filename, then, if it cannot be loaded, = try to add the prefix/suffix corresponding to the current architecture. Performance aspects shouldn't = matter for dl(). Here is an example of the logic to implement, taken from the PHK code (I = think it is the same in PEAR now, with the HP-UX case added recently) : public static function require_extension($ext) { if (extension_loaded($ext)) return; if (ini_get('enable_dl') !=3D 1) trigger_error($ext.': Cannot load extension when enable_dl is Off' ,E_USER_ERROR); if (ini_get('safe_mode') =3D=3D 1) trigger_error($ext.': Cannot load extension in safe = mode',E_USER_ERROR); if (substr(PHP_OS, 0, 3) =3D=3D 'WIN') $suffix =3D '.dll'; elseif (PHP_OS =3D=3D 'HP-UX') $suffix =3D '.sl'; elseif (PHP_OS =3D=3D 'AIX') $suffix =3D '.a'; elseif (PHP_OS =3D=3D 'OSX') $suffix =3D '.bundle'; else $suffix =3D '.so'; @dl('php_'.$ext.$suffix) || @dl($ext.$suffix); if (!extension_loaded($ext)) throw new Exception("$ext: Cannot load = extension"); }