[mapserver-users] RE Mapserver 7 expression

Eichner, Andreas - SID Andreas.Eichner at sid.sachsen.de
Tue Feb 16 23:30:38 PST 2016


This seems to be a bug. Each list item is compared to the filter item using strncmp() but it is not checked if it is the whole string. (see https://github.com/mapserver/mapserver/blob/157fa474ff8748ec42652f49dc4e2be4ca89042e/maputil.c#L490) So the result of the list expression is true if any item in the list is a _prefix_ of the filter item. 

So line 490 should probably read:
if(!strncmp(start,shape->values[itemindex],end-start) && shape->values[itemindex][end-start] == '\0') return MS_TRUE;

You might file a bug report for this.

HTH


> -----Ursprüngliche Nachricht-----
> Von: mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org] Im
> Auftrag von Steve.Toutant at inspq.qc.ca
> Gesendet: Dienstag, 16. Februar 2016 21:02
> An: mapserver-users at lists.osgeo.org; mapserver-users
> Betreff: [mapserver-users] RE Mapserver 7 expression
> 
> And this EXPRESSION {pluie,bruine}
> will be true for this string attribute "pluie verglaçante"
> 
> It seems that there is a problem when there is a space in the string
> attribute
> 
> 
> 
> 
> 
> 
> Steve.Toutant at inspq.qc.ca@lists.osgeo.org
> Envoyé par : "mapserver-users" <mapserver-users-bounces at lists.osgeo.org>
> 
> 2016-02-16 14:57 A
> mapserver-users at lists.osgeo.org
> cc
> Objet
> [mapserver-users] Mapserver 7 expression
> 
> 
> 
> 
> 
> 
> 
> 
> Following this documentation
> http://mapserver.org/fr/mapfile/expressions.html#list-expressions
> <http://mapserver.org/fr/mapfile/expressions.html#list-expressions>
> I created the class expression
> EXPRESSION {pluie,bruine verglacante }
> 
> My problem is that this expression return true when the string attribute
> is "pluie verglacante"
> 
> I would expect only "pluie" and "bruine verglacante" to be catched by this
> expression...
> How does list expressions work?
> thanks
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> <http://lists.osgeo.org/mailman/listinfo/mapserver-users>
> 
> 



More information about the mapserver-users mailing list