Hi Colin!
On Fri, 20 Apr 2001, Colin Viebrock wrote:

> > > Specifically in my case, HTTP_ENV_VARS['USER'] is now being set.  It
> took me a while to figure out why my scripts, which use $USER as a session
> variable, were getting messed up.
> > >
> > That is because PHP inherits the environment from Apache, which in turn
> > inherits it from the shell in which you started the server. Use something
> like
> > 'env -i apachectl start' when starting apache or replace the line
> > HTTPD=/path/to/httpd with HTTPD="env -i /path/to/httpd" in apachectl, if
> using
> > it.
> >
> > that way you'll get a clean environment. If you need specific variables to
> be
> > set (like those for Oracle) use Apache SetEnv directive.
> 
> Yeah, I figured as much.  I just wondered why PHP seemed to pickup
> $HTTP_ENV_VARS['USER'] now, when it didn't before (I don't think).
> 
> Anyway, I just changed my php.ini from:
>     variables_order = "EGPCS"
> to
>     variables_order = "GPCS"
> 
::wink x 2::
well, hmm, it may be a bug after all, cause theoretically the USER var from
environ should be overwritten by a later var with the same name; 

A code snippet to reproduce that behaviour would be interesting to see.

> > > Finally, if register_globals is off, is $GLOBALS useable?  I have some
> functions that manipulate variables in the global scope.
> > yes it is, AFAIK.
> > in fact, you will find it handy to have a wrapper function/class over all
> these HTTP_*_VARS
> > arrays to validate stuff ;)
> 
> I can't face wading through 4 megs of code to switch to using HTTP_POST_VARS
> all the time. :)
well, decide how is nicer to write:
  A)  $foo = isset ($foo) ? $foo : null;  
  B)  $PV =& $HTTP_POST_VARS;
      $foo = isset($PV['foo']) ? $PV['foo'] : null;
> 
> What kind of a wrapper function/class are you suggesting?

  C) [jPHP programmer version ;) ]
      $foo = $HttpRequest->getAttribute('foo');
  D) [lazy typing Joe version] 
      $foo = $req->p('foo');

 I am currently using 3 classes implementing (sorta :) the Servlet API in PHP,
 namely HttpScriplet{Request,Response} and HttpSession, in a templating mechanism 
 based on the model proposed by J2EE (an somehow addapted to PHP) and I really felt 
 it helps a lot to alleviate the validation burden, avoid messy code  and
 generally write faster.
 
 Some while back, I proposed to Sascha to have a Session object to expose some
 friendly methods, and also the (in)famous Request/Response objects like in ASP,
 JSP or Zope, but I guess nobody likes objects that much at the C level.

 A legitimate answer would be to implement them at PHP level, true,
 and I do plan to contribute this to PEAR, if anybody is interested.
 
 Happy coding, and Colin, don't forget 'register_globals on' is *evil* ;))
 YMMV

ciao

-- teodor

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to