I would make this an issue on the github repo, but I wanted to check with
the mailing list first.  I see that `exists:` explicitly sets `nothrow`:

PHPTAL/Php/TalesInternal.php +378

    static public function exists($src, $nothrow)
        $src = trim($src);
        if (ctype_alnum($src)) return 'isset($ctx->'.$src.')';
        return '(null !== ' . self::compileToPHPExpression($src, true) .

This caused a problem for us because an inexperienced dev was using
`tal:condition="exists:one; exists:two"`.  This is an invalid TALES path,
but an exception is not thrown.

I notice that if you change `true` to `$nothrow`, it will throw the
appropriate exception for this, which is good, but it will still work
properly if the variable is not set at all.  At first I thought not
throwing the exception was to avoid exception on unset variable -- the
entire point of `exists`, but this does not appear to be the case.

In summary, can we have `exists:` throw exceptions normally?

Andrew Crites
Chief of http://AySites.com/
PHPTAL mailing list

Reply via email to