Re: newbie question about scope

From: Date: Wed, 12 Nov 2003 14:22:56 +0000
Subject: Re: newbie question about scope
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-169272@lists.php.net to get a copy of this message
"Derek Ford" <lateralus@nutextonline.com> wrote in message news:3FB23F8E.60600@nutextonline.com... > news.comcast.giganews.com wrote: > > >I am an experienced web developer who is just getting into php. I have had > >a php project fall into my lap and wanted a little advice. Here is the > >scoop: > > > > A client moved their site from a server (unknown details) to a hosting > >facility (php 4.3.2). Now none of the scripts work. I have guessed that > >they are coming from an earlier version of apache/php. Anyway it appears > >that whoever created the site in the first place did not believe in scoping > >variables. Now any variable that is not properly scoped will not be read by > >the server. I know I can simply scope all of the variables, but I was > >hoping there may be an easier way. Also, how bad is the _REQUEST scope I > >read that "it could not be trusted", however the previous developer created > >the app in such a way that several places a variable could be _GET or _POST. > >I apologize for the rambling and possible incoherency of this message, I am > >a bit tired. > > > >Matthew > > > >PS. How do you scope queries? > > > > > > > You're thinking about this in the wrong way, it seems. The server > probably has register_globals Off, where previously he was programming > with it being On. or vise-versa. They should be Off, and should be left > off, but programming with them off needs some adjusting. Variables such > as post and get data are now 'superglobals', and must use the > appropriate arrays; $_GET[], and $_POST[]. There are things like > extract(), but using them is not advised. as per your question about > "scope queries", be more concrete :) I agree that is the way it should be, but my client is looking for a quick fix, not a good one. In the end it is fortunate for my client that the quick fix is not a viable one. I agree that all variables should be scoped, it is the right way to do things. I think I have my query question figured out. Thanks

« previous php.general (#169272) next »