Discussion:
[Mason-devel] [PATCH] Compiler fatal error on unbalanced content tags
Rich Williams
2007-06-07 10:27:44 UTC
Permalink
All,

I had a stray </&> in a %method, and the compiler died ...

Can't use an undefined value as an ARRAY reference at
.../HTML/Mason/Compiler.pm line 566

It's the test which is checking for balanced tags which is failing -
it works fine for top level components, but not for %def or %method,
because comp_with_content_stack is only initialised in
start_component, which (as far as I can tell) isn't called for
sub-components.

The attached patch simply changes the test a little (a similar method
is used elsewhere in Compiler.pm). I've also added two new test cases,
one to catch unbalanced content ending tags in top-level components,
and one to catch them in sub-components.

Hope this helps.

Have fun,

Rich
John Williams
2007-06-07 21:06:16 UTC
Permalink
This looks good, thanks.

Unfortunately, I have forgotten my password to the svn repository.
I guess I'm not contributing much lately.

Dave, can you apply this patch? I've added a Changes entry, and another
test, since I didn't see any test explicitly for using <&| inside a
subcomponent.

~ John Williams
Post by Rich Williams
All,
I had a stray </&> in a %method, and the compiler died ...
Can't use an undefined value as an ARRAY reference at
.../HTML/Mason/Compiler.pm line 566
It's the test which is checking for balanced tags which is failing -
it works fine for top level components, but not for %def or %method,
because comp_with_content_stack is only initialised in
start_component, which (as far as I can tell) isn't called for
sub-components.
The attached patch simply changes the test a little (a similar method
is used elsewhere in Compiler.pm). I've also added two new test cases,
one to catch unbalanced content ending tags in top-level components,
and one to catch them in sub-components.
Hope this helps.
Have fun,
Rich
Loading...