Opened 16 years ago

Closed 15 years ago

#2781 closed defect (fixed)

Tag parsing in template code fails if ]'s are in arguments, even if quoted.

Reported by: sdlime Owned by: aboudreault
Priority: normal Milestone: 5.4 release
Component: Documentation - MapServer Version: 5.2
Severity: normal Keywords:
Cc: aboudreault, dmorissette

Description (last modified by dmorissette)

A tag like this is useful for outputting GeoJSON:

  [shpxy precision="0" ph="[" pf="]" xh="[" yf="]" ps=","]

It constructs a part from an array of points. MapServer 5.2 segfaults with this. Turning the inside ]'s into something else makes things work but is useless. The tag parser needs to be smarter and skip these characters IF then are in quotes.

Steve

Attachments (1)

bug2781.patch (8.0 KB ) - added by aboudreault 15 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 by dmorissette, 16 years ago

Cc: aboudreault added
Description: modified (diff)

comment:2 by aboudreault, 16 years ago

Steve, do you have an example of mapfile/data that i can use to test this bug ?

comment:3 by aboudreault, 16 years ago

Owner: changed from dmorissette to aboudreault

It's ok Steve, i've found a demo here that i can use.

comment:4 by sdlime, 16 years ago

Crap, sorry. I meant to do that this morning and got distracted.

Steve

comment:5 by aboudreault, 16 years ago

Cc: dmorissette added

No problem Steve. Here's a patch for allowing ']' character in template (have to be quoted).

Note: Before, the character ']' was used in internal processing to allow the parser to output '=' character in the template. So, in the first part of the process, '=' was converted in ']' and in the second part all character ']' was converted in a '='. I replaced this replacement by a '\' character. This result to if we put a '\' in the template, it will be transformed in a '='. Do you think that can cause a problem ? If so, we can just take another one character.k

comment:6 by dmorissette, 15 years ago

My first reaction is that yes, having all '\' converted to '=' will be a bad side-effect. (I'd have to look at the code but I don't understand why '=' had to be converted to ']' in the previous version)

comment:7 by aboudreault, 15 years ago

I think it's becauce of the msStringSplit method that is used to split arguments (name=value). If i remember well, it fails if the value contains a '='.

by aboudreault, 15 years ago

Attachment: bug2781.patch added

comment:8 by aboudreault, 15 years ago

I joined a new patch. We improved the tags parsing method. We can now put any character inside the quotes of the tags values. For the character ", write two consecutive ".

comment:9 by sdlime, 15 years ago

Great news! This will really help with some of the more complex tag processing done in the newer template support. Has this been committed to the trunk?

Steve

comment:10 by dmorissette, 15 years ago

No, he has not committed to trunk yet. He has attached a patch for review, once we confirm that it looks good he will commit. If you want to test it and report then that would be great.

comment:11 by sdlime, 15 years ago

I have some good tests to try and will do so this week. I'll do some JSON output and tags within tags using [item ...].

Steve

comment:12 by aboudreault, 15 years ago

Steve, did you have the time to do the JSON tests ? It's ok if you didn't, it's not urgent. I just wondering if...

comment:13 by dmorissette, 15 years ago

Alan, I'd say go ahead and commit trunk and close this ticket. If there are problems they can be filed as new tickets and fixed later.

comment:14 by aboudreault, 15 years ago

Component: MapServer C LibraryMapServer Documentation

Commited to SVN trunk in r8268.

comment:15 by aboudreault, 15 years ago

Resolution: fixed
Status: newclosed

Documentation has been updated in r8269.

Note: See TracTickets for help on using tickets.