Problem

There are times when features generates syntax errors on exported code or when a developer may choose to manually modify a feature. In these cases, when eval() is run, a message similar to the one as follows appears:

Parse error: syntax error, unexpected ',' in /var/www/drupal/sites/biotalent/modules/contrib/features/features.export.inc(725) : eval()'d code on line 146

On sites with lots of feature modules this can be an onerous task to track down the syntax error.

Proposed Solution

Add a logging mechanism when eval() returns FALSE since this can be an indication of a syntax error during processing. Since FALSE would potentially be a valid return value we can't say for sure an error occurred, but we can log the event for further investigation by a site administrator.

Patch to follow.

CommentFileSizeAuthor
#1 2138331-eval-log.patch1.37 KBminorOffense
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

minorOffense’s picture

FileSize
1.37 KB

Proposed patch adds a watchdog warning with the module name and component being processed when the FALSE is returned.

minorOffense’s picture

Status: Active » Needs review
hefox’s picture

*scratches head* Any way we can get rid of eval... I'm not really comfortable with adding something that could mistakenly alert. Reading the php docs, correct there's no watch to catch this outside of testing false.

minorOffense’s picture

I didn't put the eval in. Features had that there. I'm just checking the result of eval.