Skip to content

xpath BUGFIX node-set compared with a boolean - #2670

Open
lamestllama wants to merge 1 commit into
CESNET:develfrom
lamestllama:fix/xpath-nodeset-boolean-comparison
Open

lamestllama wants to merge 1 commit into
CESNET:develfrom
lamestllama:fix/xpath-nodeset-boolean-comparison

Conversation

@lamestllama

Copy link
Copy Markdown

What

When one operand is a node-set and the other a boolean, moveto_op_comp() now converts the node-set with boolean() before comparing, instead of comparing node by node. The boolean case in moveto_op_comp_item(), now unreachable, is removed.

Why

Node by node, an empty node-set gave false whatever the boolean, so ../flag = false() was false with flag absent. XPath 1.0 §3.4 converts the node-set with boolean(), making it true.

Fixes #2668

Test

New test_nodeset_boolean (absent and present nodes, each operator); it fails before the fix, and all of ctest passes after it.

A node-set compared with a boolean was compared node by node, so an
empty node-set gave false whatever the boolean and the operator.
XPath 1.0 section 3.4 converts the whole node-set with boolean()
first, so an absent node compared with false() is equal.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant