Re: [new] PEAR::assertExtension()
| From: | Stig S. Bakken | Date: | Mon, 17 Jun 2002 12:57:22 +0000 |
| Subject: | Re: [new] PEAR::assertExtension() | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-7112@lists.php.net to get a copy of this message | ||
Hey, can't we just add a load_extension() function to PHP instead? :-P
- Stig
On Mon, 2002-06-17 at 13:10, Tomas V.V.Cox wrote:
> What do you think on adding a new function to PEAR.php assertExtension()
> which will:
>
> 1) Load an extension if is not loaded already
> 2) Return bool
> 3) OS independant
>
> The code:
>
> + // {{{ assertExtension()
> +
> + function assertExtension($ext)
> + {
> + if (!extension_loaded($ext)) {
> + if (OS_WINDOWS) {
> + return @dl("php_$ext.dll");
> + } elseif (PHP_OS == 'HP-UX') {
> + return @dl("$ext.sl");
> + } elseif (PHP_OS == 'AIX') {
> + return @dl("$ext.a");
> + } else {
> + return @dl("$ext.so");
> + }
> + }
> + return true;
> + }
> +
> + // }}}
>
> You know the bounch of places where such check are done, equally to the
> number of places where that check is wrong made :-)
>
> Of course the really Good Thing would be to change the dl() behaviour to
> take care automatically on it (http://bugs.php.net/bug.php?id=17798)
>
>
> Tomas V.V.Cox
>
> --
> PEAR Development Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Stig Sæther Bakken, Fast Search & Transfer ASA, Trondheim, Norway
http://pear.php.net/wishlist.php/ssb