-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[DomCrawler] Fixed filterXPath() chaining loosing the parent DOM nodes #10958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This will ensure we don't introduce regressions again when fixing symfony#10206.
$crawler = new static(null, $this->uri); | ||
|
||
foreach ($this as $node) { | ||
$domxpath = new \DOMXPath($node->ownerDocument); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabpot this method will need to be adapted when merging 2.3 into 2.4 because of the XML namespace support. See https://github.com/symfony/symfony/pull/10935/files#diff-b21c94d886a3648c0f8a59ef30df1e8aR824 for the way the code should look like in 2.4 and master
Thank you @stof. |
…nt DOM nodes (stof, robbertkl) This PR was merged into the 2.3 branch. Discussion ---------- [DomCrawler] Fixed filterXPath() chaining loosing the parent DOM nodes | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #10206 | License | MIT | Doc PR | n/a This is a fixed version of #10207, preserving the BC for XPath queries. It is the rebased version of #10935 targetting 2.3 The example given in #10260 when reporting the regression in the previous attempt is covered by the new tests added in the first commit of the PR. I also added many tests ensuring that the behavior is the same than in the current implementation. Commits ------- 80438c2 Fixed the XPath filtering to have the same behavior than Symfony 2.4 711ac32 [DomCrawler] Fixed filterXPath() chaining 8f706c9 [DomCrawler] Added more tests for the XPath filtering
@fabbot-io @stof It seems to break backwards compatibility. See this issue last comments. |
Please open an issue describing the bug you experience with a way to reproduce it with DomCrawler (the full Yii testsuite is not an isolated reproducible testcase) |
and at least try dumping the XPath query triggering the invalid query error so that we can see what gets wrong |
sure, i think will do it in nearest days. |
@fabpot so please don't revert it in the meantime. As soon as we have a proper bug report, I will work on fixing the bug instead of reverting the PR (which would reintroduce the bug it fixed yet another time) |
@stof can you provide example of how check it? what branch i should check and how? |
get the branch domcrawler_fixes of my fork (or just apply the 2-lines patch in your code manually to try it) |
This is a fixed version of #10207, preserving the BC for XPath queries. It is the rebased version of #10935 targetting 2.3
The example given in #10260 when reporting the regression in the previous attempt is covered by the new tests added in the first commit of the PR.
I also added many tests ensuring that the behavior is the same than in the current implementation.