From b6af00292d2cc95d6e8913601213a02e4f830ef9 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Sat, 21 Mar 2015 22:51:32 +0000 Subject: [PATCH] [DomCrawler] Improve namespace discovery performance Up until now xpath axes (child::*, descendant-or-self::** etc) were considered namespaces. As a result, far too many xpath queries were being executed while namespace discovery. --- src/Symfony/Component/DomCrawler/Crawler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index f51c56a302264..e8f6c8d8116ca 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -1027,7 +1027,7 @@ private function discoverNamespace(\DOMXPath $domxpath, $prefix) */ private function findNamespacePrefixes($xpath) { - if (preg_match_all('/(?P[a-z_][a-z_0-9\-\.]*):[^"\/]/i', $xpath, $matches)) { + if (preg_match_all('/(?P[a-z_][a-z_0-9\-\.]*):[^"\/:]/i', $xpath, $matches)) { return array_unique($matches['prefix']); }