Layer class LIST Expression #5245

merged 1 commit into from Feb 18, 2016


None yet
1 participant

tbonfort commented Feb 18, 2016

It seems that each list item is compared to the string attribute item but it is not checked if it is the whole string.

CLASSITEM 'event'  
EXPRESSION {rain,drizzle}

This expression above returns true if "event" string attribute = "freezing rain"
A user suggested this fix

if(!strncmp(start,shape->values[itemindex],end-start)) return MS_TRUE;

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

Here are other examples where Expression returns true, but might not be the same problem/solution

String=freezing rain
EXPRESSION {rain,freezing drizzle} #doc says no space should be used though
String=freezing rain
EXPRESSION {rain,freezing,drizzle}

tbonfort added a commit to mapserver/msautotest_DEPRECATED that referenced this pull request Feb 18, 2016

@tbonfort tbonfort merged commit 0d71c41 into mapserver:branch-7-0 Feb 18, 2016

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed

@tbonfort tbonfort deleted the tbonfort:issues/5245-list-expression-bug branch Feb 18, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment