ruby / ruby/rexml

XPath silently ignores erroneous evaluation where a nodeset is required

Open
#350 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
182
Forks
99
Avg merge
2d 23h
Merged PRs (30d)
8

Description

In XPath evaluation, some evaluated part is required to be a nodeset. If not, it should result in error.
https://github.com/ruby/rexml/pull/342#discussion_r3566072520

Examples:

# Function argument that requires nodeset
local-name(1)
sum("string")
count(1 < 2)

# Path after function that doesn't return a nodeset
# id("a")/path id("a")[predicate] is valid
string(a/b)[predicate]
string(a/b)/path

# Path after non-nodeset variable
$x[predicate]
$x/path

# Path after literal
"string"[predicate]
42/path

# Path after neg
-number(a/b)[predicate]
-number(a/b)/path

# Path after parenthesized expression
(1)[predicate]
(1)/path

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing REXML's XPath evaluation for the listed expressions and the discussion linked in pull request #342. Check how function arguments, path expressions, variables, literals, negation, and parenthesized expressions handle non-nodeset values. Done means each example that requires a nodeset reports an evaluation error instead of being silently ignored, while the valid id() cases remain valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.