You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Henrik Tougaard <ht...@foa.dk> on 2000/08/11 19:48:18 UTC

Bug in Apache::ASP XMLSubs when an argument includes '>'-characte rs?

I have been trying to test the limits of the nice new XMLSub feature in
Apache::ASP, and seem to have discovered a bug.

With this simple .asp page I get an error:

    <Fiks:test Start="<b>"> </Fiks:test>
[My XMLSubMatch is set to Fiks:\w+  - the name of the subroutine doesn't
matter]

It seems as if the '>' in the '<b>' argument confuses the parser.
The compiled perl script is (reformatted for readability - somewhat -
everything
was on one line!):

package Fiks::Web; ;; 
sub Fiks::Web::_bruger_ht00_Fagsys_www_orgvalg_fejl_aspxINL {
 ;;  @_ = (); ;;
 no strict;;
 use vars qw($Application $Session $Response $Server $Request);;
 Fiks::test({  Start=>"<b }, '" >'); ;  ;; }

The error is:
Can't find string terminator "'" anywhere before EOF at (eval 140) line 1,
<GEN10> line 1.

Is this a (mis)feature or a parser bug?

Regards
Henrik Tougaard, ht000@foa.dk
Forbundet af Offentligt Ansatte, Copehagen, Denmark.

Re: Bug in Apache::ASP XMLSubs when an argument includes '>'-characte rs?

Posted by Matt Sergeant <ma...@sergeant.org>.
On Fri, 11 Aug 2000, Henrik Tougaard wrote:

> I have been trying to test the limits of the nice new XMLSub feature in
> Apache::ASP, and seem to have discovered a bug.
> 
> With this simple .asp page I get an error:
> 
>     <Fiks:test Start="<b>"> </Fiks:test>
> [My XMLSubMatch is set to Fiks:\w+  - the name of the subroutine doesn't
> matter]
> 
> It seems as if the '>' in the '<b>' argument confuses the parser.

[snip]

> Is this a (mis)feature or a parser bug?

parser bug - it should have died earlier at the < sign :-)

XML attributes can't contain "<" or "&" characters, or the same quote that
they are surrounded by. The following are the encodings you can use
(and XMLSubsMatch needs to unravel):

<   =>  "&lt;"
>   =>  "&gt;"
&   =>  "&amp;"
"   =>  "&quot;"
'   =>  "&apos;"

Note that only "<" is needed for your example (since encoding the
">" isn't mandatory in XML generally).

-- 
<Matt/>

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org