This is my code;
$script = $row['script'];
// $row is from database and the $row['script'] is exeactly the same with $script commented below.
// $script ="global \$timedate;\$target =\$timedate->now();return \$target;";
return eval($script);
When I uncomment the $script, it will run correctly. However, if I commnent $script and load the value from $row[‘script’], the eval get error below:
[12-May-2012 22:09:25 UTC] PHP Parse error: syntax error, unexpected $end in C:\Users\iopen\Documents\IOPEN\Project\Clients\sugarcrm\hfcrmlocal\custom\modules\iopenwf\model\IOpenAction.php(56) : eval()'d code on line 3
Any idea?
Don’t use
evalits a very bad idea.For experimenting purpose you can use
stripslashesto remove most slashes issues