Reputation: 2633
When i login to my drupal page. It's showing the following error
Parse error: syntax error, unexpected '<' in /document_root/sites/all/modules/rules/rules/modules/php.rules.inc(107) :
eval()'d code on line 1
When i just figure out to the particular page there is no problem in that function . Below is the function where the error marked..
function rules_php_eval_return($code, $arguments = array()) {
extract($arguments);
return eval($code);
}
Could any one can suggest me what's the problem may be!! It's drupal 6.x version.
Upvotes: 2
Views: 4032
Reputation: 3849
I don't know drupal, but i think that $code contains something like :
$code = '<?php $someCode;';
eval($code);
//Produces : Parse error: syntax error, unexpected '<' in file(1) : eval()'d code on line 1
The error is telling you that $code
contains a parse error (maybe the phptag)
You can echo $code
to check what's wrong.
Upvotes: 1
Reputation: 973
I just had this same problem trying to process data returned from an HTTP request. I was using simplexml_load_string, but the HTTP response was an error, so the data was not formatted as XML, thus causing simplexml to error (propogate up). My message was the same as yours, "error in file on line X; eval'd() code on line X". So, it may not necessarily be an error within your code, or even the eval'd code.
While it looks like you don't have the following issue, it is something to keep in mind as well. When declaring variables within the eval'd code they will scope the same as if inline in the file. Similarly, variables preceding the eval'd code are available within it, and may cause collisions, or inadvertent re-assigning (eg. $i in nested loops).
Upvotes: 0
Reputation: 21
I came accross an error like this when I pasted a PHP code snippet from the Drupal site into a block to show submenus. These submenus were detected and assigned in a foreach loop, but since there weren't any submenus, the menu variable remained unassigned and thus undeclared as well.
My obvious solution was to assign an empty string to the menu variable before the foreach loop.
Upvotes: 2
Reputation: 4658
eval'd usually comes when bad custom php codes embeded in site using php module(php filter) If you can access site in anyway, go to Triggered Rules and Rule Sets page and find if any rule is firing a custom php code. It's idiot's style to put php codes in Rules. Either you should create a module or use Rules itself :)
If you can't access the site, go to /modules folder and move the "php" folder somewhere else. Then you will be able to access site. Quickly remove buggy code and replace the folder. Then, start debugging it.
Upvotes: 0