-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Crawler default namespace fix #9771
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
ubot detected some small issues in this pull request. You can make the modifications by hand or run the following command from the repository root directory:
diff -ru src/Symfony/Component/DomCrawler/Crawler.php src/Symfony/Component/DomCrawler/Crawler.php
--- src/Symfony/Component/DomCrawler/Crawler.php 2013-12-15 09:28:56.199122873 +0000
+++ src/Symfony/Component/DomCrawler/Crawler.php 2013-12-15 09:28:56.535122873 +0000
@@ -201,7 +201,7 @@
public function addXmlContent($content, $charset = 'UTF-8')
{
// remove the default namespace if it's the only namespace to make XPath expressions simpler
- if(!preg_match('/xmlns:/', $content)) {
+ if (!preg_match('/xmlns:/', $content)) {
$content = str_replace('xmlns', 'ns', $content);
}
|
ping @jakzal |
@fabpot I've helped with this PR during the hack day so I'm 👍 This seems to be the only way to revert the BC break partially. This PR brings back the hack which we used to have, but only for the scenario when there's a single namespace and it is a default namespace. So it simplifies filtering for single namespace documents and keeps it flexible for multiple namespace ones. It might be worth documenting. I'll send a PR if we all agree it's good to merge. |
@crudecki also, ubot suggest a small CS fix ;) |
I think we should also update the CHANGELOG.md:
|
I've removed the unnecessary merge |
@crudecki Great, can you add the suggested change in the CHANGELOG? |
Done it through Github interface, hope this is fine. |
Doing so through github interface results in a new PR: #9800 |
@crudecki Go at this page: https://github.com/crudecki/symfony/blob/crawlerDefaultNamespaceFix/src/Symfony/Component/DomCrawler/CHANGELOG.md and edit file there, after that it will be in this PR so you can close #9800. |
Added changelog message for the Crawler::addXmlContent() BC break fix with one default namespace.
Done : ) help in getting started with contributing much appreciated : ) thanks |
🍺 |
This PR was squashed before being merged into the 2.4 branch (closes #9771). Discussion ---------- Crawler default namespace fix | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | #9732, #6650 | License | MIT | Doc PR | symfony/symfony-docs/pull/2979 Fix backwards compatibility of xml namespaces for having only one default namespace. Commits ------- cfff054 Crawler default namespace fix
Fix backwards compatibility of xml namespaces for having only one default namespace.