Gossamer Forum
Home : General : Internet Technologies :

Eval probs...

Quote Reply
Eval probs...
Ok, this is in PHP...before anyone thinks it Perl Wink

I'm having a problem with the following line of code on only a couple of server types;

Code:
eval("\$vars_val =& \$GLOBALS[$vars]$suffix;");

The error reported is:

Parse error: parse error, expecting `']'' in
/home/bizlande/bizlande-www/ezine/send.php(13) : eval()'d code on line 1

Now, the weird part is that it works on all my test runs of the script, and also on several other servers...but just not this one. Has anyone got any ideas why it work work? :|

Thanks

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Eval probs... In reply to
I don't know much about PHP, but that shouldn't be:

Code:
eval("\$vars_val =& \$GLOBALS['$vars']$suffix;");

There was also some kind of bug with this, in earlier versions, so check a few usenet newsgroups or a few mailing lists and you might be able to track this one down.

When I searched, I got:

http://groups.google.com/....chek.com&rnum=3

http://news.php.net/...ugs&article=7256

Good luck

- wil

Last edited by:

Wil: May 27, 2002, 11:39 AM
Quote Reply
Re: [Andy] Eval probs... In reply to
The following web page may help:

http://www.php.net/...en/function.eval.php

Also, a quick search at Google using PHP eval statement parse error turned up a bunch of what could be helpful links.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Wil] Eval probs... In reply to
Someone just told me about a possible difference in PHP 4.0 and 4.1. I had it working locally on my machine with PHP 4.0.6, and the one I am having problems with is 4.1.2. Could it be this version difference that is causing the problem?

Thanks

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Stealth] Eval probs... In reply to
Never mind. I sorted it. I'm using this code now to remove the magic quotes;

Code:
// Remove automatic quotes added to POST/COOKIE by PHP
if (get_magic_quotes_gpc ()) {
for (reset ($HTTP_POST_VARS); list ($k, $v) = each
($HTTP_POST_VARS); )
$$k = stripslashes ($v);
for (reset ($HTTP_COOKIE_VARS); list ($k, $v) = each ($HTTP_COOKIE_VARS); )
$$k = stripslashes ($v);
}

Thanks for your replies Smile

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!