Skip to content

Commit b4bcba2

Browse files
committed
Fix XPath '//' optimization with predicates
My attempt to optimize XPath expressions containing '//' caused a regression reported in bug #695699. This commit disables the optimization for expressions of the form '//foo[predicate]'.
1 parent ff76eb2 commit b4bcba2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

xpath.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -14724,8 +14724,9 @@ xmlXPathOptimizeExpression(xmlXPathCompExprPtr comp, xmlXPathStepOpPtr op)
1472414724
* internal representation.
1472514725
*/
1472614726

14727-
if ((op->ch1 != -1) &&
14728-
(op->op == XPATH_OP_COLLECT /* 11 */))
14727+
if ((op->op == XPATH_OP_COLLECT /* 11 */) &&
14728+
(op->ch1 != -1) &&
14729+
(op->ch2 == -1 /* no predicate */))
1472914730
{
1473014731
xmlXPathStepOpPtr prevop = &comp->steps[op->ch1];
1473114732

0 commit comments

Comments
 (0)