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

Skip to content

[DomCrawler] fix the axes handling in a bc way #11624

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 1 commit into from
Aug 19, 2014

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Aug 9, 2014

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #11503
License MIT
Doc PR

The previous fix in #11548 for handling XPath axes was not backward compatible. In previous Symfony versions the Crawler handled nodes by holding a "fake root node". This must be taken into account when evaluating (relativizing) XPath expressions.

The previous fix in symfony#11548 for handling XPath axes was not backward
compatible. In previous Symfony versions the Crawler handled nodes
by holding a "fake root node". This must be taken into account when
evaluating (relativizing) XPath expressions.
} elseif ('/' === $expression[0]) {
$expression = 'self::'.substr($expression, 2);
} elseif (0 === strpos($expression, 'child::')) {
$expression = 'self::'.substr($expression, 7);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure about this normalization (please run your new tests against a 2.3.13 codebase to ensure it works the same)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, child::foo is equivalent to ./foo (which is covered with a similar test in testFilterXpathComplexQueries()).

I applied the tests on Symfony 2.3.13 in this branch. The only tests being skipped are the ones affecting the fake root node and the namespace axes. The results are here.

xabbuh added a commit to xabbuh/symfony that referenced this pull request Aug 12, 2014
@stof
Copy link
Member

stof commented Aug 13, 2014

👍

1 similar comment
@romainneutron
Copy link
Contributor

👍

@stof
Copy link
Member

stof commented Aug 19, 2014

Thanks for fixing this bug @xabbuh.

@stof stof merged commit d26040f into symfony:2.3 Aug 19, 2014
stof added a commit that referenced this pull request Aug 19, 2014
This PR was merged into the 2.3 branch.

Discussion
----------

[DomCrawler] fix the axes handling in a bc way

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #11503
| License       | MIT
| Doc PR        |

The previous fix in #11548 for handling XPath axes was not backward compatible. In previous Symfony versions the Crawler handled nodes by holding a "fake root node". This must be taken into account when evaluating (relativizing) XPath expressions.

Commits
-------

d26040f [DomCrawler] fix the axes handling in a bc way
@xabbuh xabbuh deleted the dom-crawler-bc-axes-fix branch August 19, 2014 12:16
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.

3 participants