Skip to content

Commit

Permalink
calc.php: escape % in code before logging
Browse files Browse the repository at this point in the history
so sprintf in logEval won't break (php8) with' x arguments required, y given'
  • Loading branch information
trob committed Feb 22, 2023
1 parent e218990 commit f051859
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/fabrik_element/calc/calc.php
Expand Up @@ -47,7 +47,7 @@ public function getDefaultValue($data = array())
{
$res = @eval($default);
}
FabrikWorker::logEval($res, 'Eval exception : ' . $element->name . '::getDefaultValue() : ' . $default . ' : %s');
FabrikWorker::logEval($res, 'Eval exception : ' . $element->name . '::getDefaultValue() : ' . str_replace('%','%%',$default) . ' : %s');
$default = $res;
}
*/
Expand Down Expand Up @@ -103,7 +103,7 @@ private function _getV($data, $repeatCounter)
$d = $data;
FabrikWorker::clearEval();
$res = FabrikHelperHTML::isDebug() ? eval($default) : @eval($default);
FabrikWorker::logEval($res, 'Eval exception : ' . $this->getElement()->name . ' (id ' . $this->getId() . ')::_getV() : ' . $default . ' : %s');
FabrikWorker::logEval($res, 'Eval exception : ' . $this->getElement()->name . ' (id ' . $this->getId() . ')::_getV() : ' . str_replace('%','%%',$default) . ' : %s');

return $res;
}
Expand Down Expand Up @@ -319,7 +319,7 @@ public function preFormatFormJoins($data, $row)
$res = @eval($cal);
}

FabrikWorker::logEval($res, 'Eval exception : ' . $element->name . ' (id ' . $this->getId() . ')::preFormatFormJoins() : ' . $cal . ' : %s');
FabrikWorker::logEval($res, 'Eval exception : ' . $element->name . ' (id ' . $this->getId() . ')::preFormatFormJoins() : ' . str_replace('%','%%',$cal) . ' : %s');

$res = $this->getFormattedValue($res);

Expand Down

0 comments on commit f051859

Please sign in to comment.