Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
jlav1n committed Oct 24, 2017
1 parent 4081aac commit 197edf2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/Vend/Ship.pm
Expand Up @@ -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.",
Expand Down

0 comments on commit 197edf2

Please sign in to comment.