[interchange] Resolve shipping tag Safe issue in perl block

Josh Lavin interchange-cvs at icdevgroup.org
Tue Oct 24 16:32:32 UTC 2017


commit 197edf26560803282722cc98c765e5c5d898685b
Author: Josh Lavin <digory at cpan.org>
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.",



More information about the interchange-cvs mailing list