Skip to content

[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

Merged
merged 3 commits into from
May 21, 2014

Conversation

stof
Copy link
Member

@stof stof commented May 21, 2014

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.

$crawler = new static(null, $this->uri);

foreach ($this as $node) {
$domxpath = new \DOMXPath($node->ownerDocument);
Copy link
Member Author

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

@fabpot
Copy link
Member

fabpot commented May 21, 2014

Thank you @stof.

@fabpot fabpot merged commit 80438c2 into symfony:2.3 May 21, 2014
fabpot added a commit that referenced this pull request May 21, 2014
…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
@stof stof deleted the domcrawler_xpath_filtering branch May 21, 2014 15:49
@Ragazzo
Copy link

Ragazzo commented May 22, 2014

@fabbot-io @stof It seems to break backwards compatibility. See this issue last comments.

@stof
Copy link
Member Author

stof commented May 22, 2014

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)

@stof
Copy link
Member Author

stof commented May 22, 2014

and at least try dumping the XPath query triggering the invalid query error so that we can see what gets wrong

@Ragazzo
Copy link

Ragazzo commented May 22, 2014

sure, i think will do it in nearest days.

@stof
Copy link
Member Author

stof commented May 22, 2014

@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
Copy link
Member Author

stof commented May 24, 2014

@Ragazzo can you check whether #10987 fixes the issue for you ?

@Ragazzo
Copy link

Ragazzo commented May 24, 2014

@stof can you provide example of how check it? what branch i should check and how?

@stof
Copy link
Member Author

stof commented May 24, 2014

get the branch domcrawler_fixes of my fork (or just apply the 2-lines patch in your code manually to try it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy