[interchange] Resolve shipping tag Safe issue in perl block
Josh Lavin <[email protected]> Tue, 24 Oct 2017 16:32:32 +0000
| Newsgroups | gmane.comp.web.interchange.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 197edf26560803282722cc98c765e5c5d898685b Author: Josh Lavin <[email protected]> Date: Tue Oct 24 09:29:22 2017 -0700 Resolve shipping tag Safe issue in perl block - if $Tag->shipping() is called from a catalog-level [perl] block, it would fail with thrown error of: 'eval "string"' trapped by operation mask - if you are already in a Safe container, then don't start _another_ one with `reval` lib/Vend/Ship.pm | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) --- diff --git a/lib/Vend/Ship.pm b/lib/Vend/Ship.pm index bc237ef..9dd417d 100644 --- a/lib/Vend/Ship.pm +++ b/lib/Vend/Ship.pm @@ -763,7 +763,12 @@ sub shipping { $formula =~ s/\@\@CRIT\@\\?\@/$total/ig; $formula = interpolate_html($formula) if $formula =~ /__\w+__|\[\w/; - $cost = $Vend::Interpolate::ready_safe->reval($formula); + if($MVSAFE::Safe) { + $cost = eval($formula); + } + else { + $cost = $Vend::Interpolate::ready_safe->reval($formula); + } if($@) { $error_message = errmsg( "Shipping mode '%s': bad formula. Returning 0.",