Re: Re: Eval a file, and it gives parse error because it uses a preg_match statement with \$

From: Date: Tue, 03 Aug 2004 21:15:10 +0000
Subject: Re: Re: Eval a file, and it gives parse error because it uses a preg_match statement with \$
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-192623@lists.php.net to get a copy of this message
Another note: I code for globals off. "Justin Patrin" <papercrane@gmail.com> wrote in message news:432beae040803133911d3932b@mail.gmail.com... > On Tue, 3 Aug 2004 12:11:02 -0700, Josh Acecool M > <webmaster@acecoolco.com> wrote: > > It has a preg_match in there that looks for \$variable = blah; > > > > I cant help that a file works without Eval, and then to eval it, it messes > > it up... > > And why again are you using *eval* on a file? Why not > include('file.php')? If you're doing parsing on the file contents, > look there for your problem. It's likely you're adding backslashes > somewhere. Look at the contents of the string you're trying to eval > and see if it looks the same as the file you want to run. If not, > that's your problem. > > If you're not adding slashes, perhaps magic_quotes_runtime or > magic_quotes_gpc is? (These are php.ini settings) > > What vars aren't getting passed in? Globals? Looks like this is OOP, > in which case globals aren't in scope while you're in a function. You > call a function to run the template and the globals are automtically > out of scope. You can do several things here. > 1) Use $GLOBALS['varname'] instead of $varname in your eval'd script. > 2) If you're using globals for request vars (GET or POST) then you > should switch to the superglobals $_GET and $_POST (or $_REQUEST). > 3) global everything in $GLOBALS before you run eval() > foreach ($GLOBALS as $key => $val) { > $$key =& $GLOBALS[$key]; > } > > If none of this works, perhaps safe mode is stopping this? (I'm not > sure if it even can, but it's a possibility.) > > > > > "John Holmes" <holmes072000@charter.net> wrote in message > > news:410FD249.9010004@charter.net... > > > > > > > Josh Acecool M wrote: > > > > var $The_Template_Sys; > > > > > > > > $this -> The_Template_Sys = > > > > file_get_contents("$The_Template_File"); > > > > > > > > $this -> Sub_Template = TRUE; > > > > > > Please respond to the list and not me personally. > > > > > > you say you're getting a parse error. How could anyone possibly help you > > > troubleshoot that parse error unless they had an example of what was in > > > the file being eval()'d?? > > > > > > -- > > > > > > John Holmes > > > > > > php|architect - The magazine for PHP professionals - > > http://www.phparch.com > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > !DSPAM:410fe2cd117221951811678! > > > > > > > -- > DB_DataObject_FormBuilder - The database at your fingertips > http://pear.php.net/package/DB_DataObject_FormBuilder > > paperCrane --Justin Patrin--

« previous php.general (#192623) next »