Re: cvs: php4 /pear System.php

From: Date: Sun, 25 Aug 2002 23:32:05 +0000
Subject: Re: cvs: php4 /pear System.php
References: 1  Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-5968@lists.php.net to get a copy of this message
Why don't you check if it is in $_ENV first? a getenv() call is very expensive. Which is also why not populating $_ENV unless it is needed helps overall performance a bit. On Sun, 25 Aug 2002, Pierre-Alain Joye wrote: > pajoye Sun Aug 25 14:11:24 2002 EDT > > Modified files: > /php4/pear System.php > Log: > Remove $_ENV usages, this causes problems with recommanded php.ini files > Replace by getenv() > > > Index: php4/pear/System.php > diff -u php4/pear/System.php:1.17 php4/pear/System.php:1.18 > --- php4/pear/System.php:1.17 Sat Aug 10 12:33:08 2002 > +++ php4/pear/System.php Sun Aug 25 14:11:24 2002 > @@ -16,7 +16,7 @@ > // | Authors: Tomas V.V.Cox <cox@idecnet.com> | > // +----------------------------------------------------------------------+ > // > -// $Id: System.php,v 1.17 2002/08/10 16:33:08 cox Exp $ > +// $Id: System.php,v 1.18 2002/08/25 18:11:24 pajoye Exp $ > // > > require_once 'PEAR.php'; > @@ -43,7 +43,7 @@ > * > * @package System > * @author Tomas V.V.Cox <cox@idecnet.com> > -* @version $Revision: 1.17 $ > +* @version $Revision: 1.18 $ > * @access public > * @see http://pear.php.net/manual/ > */ > @@ -391,27 +391,29 @@ > function tmpdir() > { > if (OS_WINDOWS) { > - if (System::_myenv('TEMP')) { > - return System::_myenv('TEMP'); > + if (getenv('TEMP')) { > + return getenv('TEMP'); > } > - if (System::_myenv('TMP')) { > - return System::_myenv('TMP'); > + if (getenv('TMP')) { > + return getenv('TMP'); > } > - if (System::_myenv('windir')) { > - return System::_myenv('windir') . '\temp'; > + if (getenv('windir')) { > + return getenv('windir') . '\temp'; > } > - return System::_myenv('SystemRoot') . '\temp'; > + return getenv('SystemRoot') . '\temp'; > } > - if (System::_myenv('TMPDIR')) { > - return System::_myenv('TMPDIR'); > + if (getenv('TMPDIR')) { > + return getenv('TMPDIR'); > } > return '/tmp'; > } > > - /** > + /** > + * (pajoye) Removed, problem with php.ini-recommanded, E removed > + * > * (cox) I always get $_ENV empty in both Windows and Linux > * with all PHP version <= 4.2.1 > - */ > + > function _myenv($var) > { > if (!empty($_ENV)) { > @@ -419,6 +421,7 @@ > } > return getenv($var); > } > + */ > > /** > * The "type" command (show the full path of a command) > > > > -- > PEAR CVS Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.pear.cvs (#5968) next »