Precise error is "Fatal error: Cannot redeclare user_has_role() (previously declared in /usr/home/adpca/public_html/adpca.org.736/modules/user/user.module:863) in /usr/home/adpca/public_html/adpca.org.736/modules/php/php.module(80) : eval()'d code on line 23"

This is in an eval statement I've been through through code base looking for any duplication of the function user_has_role and can't find any. Also been through the databases looking for anything that might trigger the duplicate eval but no joy so far. Anybody got any pointers on what to look for?

  • Update. I've traced the issue to the cron.php. This was set to automatically tag itself onto the user page. Poor man's cron telling it to never do this removes the error from all the pages. However, when I run cron manually or using curl from the linux command prompt I get the error above. Commented May 5, 2015 at 23:42

1 Answer 1


The user_has_role() function has been introduced with Drupal 7.36, as stated here, and detailed here.

Following information given by the error message you received we see that:

  • the function is primarily declared in modules/user/user.module:863: looking at the code of the user module confirm this, ok
  • the new declaration is said to happen through modules/php/php.module(80): again, looking at the code of the php module confirms that line 80 executes eval('?> . $code);, ok
  • so the culpry supplemental declaration should be found at line 23 of the PHP content of a field which uses a format where the (not so usual) PHP evaluator filter has been enabled

IMO you should:

  1. review all of your defined text formats, in order to select which of them have PHP evaluator filter enabled
  2. from this reduced list, look for any node or block using these text formats (should not be as many)
  3. then review the corresponding contents, where you'll probably find that somebody had created its own user_has_role() function for its needs, since it didn't exist yet before 7.36


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.