It looks like
<tal:block tal:define="label preferences/label|label" tal:replace="structure
result in a null value for variable label if preferences/label is not
defined, even if label is defined.

The problem comes from the generated code which looks like
if (($ctx->label = phptal_path($ctx->preferences, 'label', true)) !==
null):  ;
elseif (($ctx->label = $ctx->label) !== null):  ;
endif ;

This might not be a bug but the right side expression should be evaluated
first before assignment.
A quick workaround would be to do something like
<tal:block tal:define="xlabel preferences/label|label;label xlabel;"
tal:replace="structure label"/>
which works, but looks pretty ugly especially if you have lots of variables
to define in tal:define attribute.

Ciprian Vieru
PHPTAL mailing list

Reply via email to