Thread: Readding eval()
View Single Post
  #9  
Old 10-22-2006, 03:58 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Novo View Post
That thread is talking about how the engine treats conditionals.

The function eval does:
PHP Code:
if ( condition )
 return 
true;
else return 
false
And the evalFIX does
PHP Code:
return condition != false
It's talking about optimization of returns that are inconsistent, because they present two different versions. But... Technically, if something isn't true, it's false... So, if it's not false, it's true. They are two different ways to write the same thing, but they yield different results.

That is NOT what I was asking for.

eval( string ) is a Graal v3 feature that was removed due to security reasons. It was useful because it would execute the code in the string.

It is disabled, but -- If we're on Serverside, this security risk isn't true. I could script my own eval, yes... But that would mean I would have to map out all the operators, set up a parser, and actually parse the information.

This can be done, but it's very prone to flaws. It's much easier to simply use the already created ( but disabled ) version.
It is always a security issue because there will always be people who don't properly secure their code. Not only that but there will be people who will hide eval() scripts in order to abuse scripting once they have left a staff team or so.
Quote:
Originally Posted by Yen
By eval, he means something like..
eval(putexplosion,3,player.x,player.y);
or something?
PHP Code:
temp.string "myFunction(1, 2, \"foo\");";

if (eval(
temp.string))
{
  
// ...

... or so.
Reply With Quote