Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DomCrawler] filterXPath limited usage since 2.3.14 #11503

Closed
@dol

Description

@dol

I used the DomCrawler::filterXPath method to do some filtering. Since this update 80438c2, the filterXPath method can't handle a simple queries like 'child::div'.
The error is the same as in #10986 .

Warning: DOMXPath::query(): Invalid expression in /vendor/symfony/symfony/src/Symfony/Component/DomCrawler/Crawler.php on line 832

Most of the listed XPath axes have a problem with this change.

The main cause to this problem is, that the method 'relativize' will append 'self::' to every expression, that's not matched in here.

As a result to this, the XPath expression is invalid.
E.g:
Input

child::div

relativized Xpath

self::child::div

The W3C spec don't allow Xpath expressions like the relativized one.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions