<div dir="auto">It is much safer to avoid eval() if you can get around it</div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Tue, Feb 10, 2026, 10:15 a.m. Hans Bracker <<a href="mailto:design@softflow.uk">design@softflow.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I am using the latest MarkupExprPlus.<br>
<br>
Trying to write well behaving markup expressions I've now learned this:<br>
<br>
1. My strcount Mx is okay (don't know if it is good), but the result is <br>
in a keep token.<br>
2. For a calculating Mx I need to avoid using $params and avoid using <br>
$argp, because both times the value is not getting in, but only the <br>
token string.<br>
3. Using $args is okay and the value from an embedded strcount Mx is <br>
getting processed.<br>
<br>
An example for a working multiplication Mx, which can take a multiple of <br>
args:<br>
<br>
// (multi num1 num2 ...) for multiplying numbers<br>
$MarkupExpr['multi'] = 'ME_Multi($args)';<br>
function ME_Multi($args) {<br>
$a = array();<br>
foreach ($args as $i => $v)<br>
$a[$i] = floatval($v);<br>
$x = 1;<br>
foreach ($a as $i => $v)<br>
$x = $x * $v;<br>
return $x;<br>
}<br>
<br>
4. This does not use PHP eval(). Many other calc Mxs do. I imagine it is <br>
better to avoid eval() (?)<br>
<br>
5. To work with numbers which use decimal comma instead of dot, this <br>
needs to be rewritten to remove thousands dots and convert commas to <br>
dots. But that is a different topic!<br>
<br>
Hans<br>
<br>
On 10/02/2026 13:18, Petko Yotov wrote:<br>
> On 10/02/2026 13:18, Hans Bracker wrote:<br>
>> Is there another way than rewriting recipes?<br>
><br>
> I don't know.<br>
><br>
> MarkupExprPlus seems to disable the core markup expressions and add <br>
> its own full replacement.<br>
><br>
> It processes not only add/sub/mul/div but all core markup expressions, <br>
> and any custom ones you may add.<br>
><br>
> See if the problem appears with the latest version of MX+, and maybe <br>
> DFaure can reply better than me.<br>
><br>
> Petko<br>
><br>
<br>
_______________________________________________<br>
pmwiki-users mailing list<br>
<a href="mailto:pmwiki-users@pmichaud.com" target="_blank" rel="noreferrer">pmwiki-users@pmichaud.com</a><br>
<a href="http://www.pmichaud.com/mailman/listinfo/pmwiki-users" rel="noreferrer noreferrer" target="_blank">http://www.pmichaud.com/mailman/listinfo/pmwiki-users</a><br>
</blockquote></div>