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.
Comment | File | Size | Author |
---|---|---|---|
#1 | 2138331-eval-log.patch | 1.37 KB | minorOffense |
Comments
Comment #1
minorOffense CreditAttribution: minorOffense commentedProposed patch adds a watchdog warning with the module name and component being processed when the FALSE is returned.
Comment #2
minorOffense CreditAttribution: minorOffense commentedComment #3
hefox CreditAttribution: hefox commented*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.
Comment #4
minorOffense CreditAttribution: minorOffense commentedI didn't put the eval in. Features had that there. I'm just checking the result of eval.