I noticed that using the option to add php code before and after printing a cell didn't work in the latest dev version.

The problem is php_eval(). When I replaced php_eval() with the standard eval() it worked.

Change line 481 from:
php_eval($options['render']['eval_before']);
to:
eval($options['render']['eval_before']);

And line 511 from:
php_eval($options['render']['eval_after']);
to:
eval($options['render']['eval_after']);

Comments

pomliane’s picture

Status: Active » Needs review
Robin Millette’s picture

Status: Needs review » Needs work

It would probably be best to fix the module to work with the php_eval() wrapper function.

There are very good reasons to use Drupal's PHP wrapper functions.

ellen.davis’s picture

php_eval documentation says it "prevents the code being evaluated from overwriting variables in the code that called it"

But, by looking at some scripts that have been posted, it looks like they do exactly that - overwrite variables in the code.

So, maybe a permission is needed.

$access = user_access('use PHP in before/after');
if ($access) {
  eval($options['render']['eval_before']));
}

But, I guess it would be more complicated than that. The form should not even be displayed unless you have the 'use PHP in before/after' permission.

kevster’s picture

I have also come across this problem with latest dev version - I cannot get anything to display in PHP before and after.

I also get a "This operation is not allowed" Adobe PDF document popup when trying to view the PDF.

Thx..

lsolesen’s picture

Status: Needs work » Active

No patch to work on, so changing to active.

s.daniel’s picture

Status: Active » Closed (duplicate)