Posted by ben.bunk on October 15, 2011 at 10:39pm
When working with a script expression, strict comparisons might not work exactly like you would expect. For example, when strictly comparing for a TRUE value this will likely fail:
<?php
%input === TRUE
?>
Here is an example where I stumbled onto this:
<?php
function _multifactor_validate_pin($pin = NULL) {
return TRUE;
}
$script->addSet('success', '^_multifactor_validate_pin(%pin)');
$script->addGotoIf('success_message', '^%success === TRUE');
?>
Unfortunately, the above addGotoIf will always evaluate to FALSE. The callback returns TRUE but the result is type juggled into a numeric '1' somewhere along the way. Either of the following examples is a viable replacement.
<?php
$script->addGotoIf('success_message', '^%success == TRUE');
?>
<?php
$script->addGotoIf('success_message', '^%success === 1');
?>