Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d259c84

Browse filesBrowse files
committed
bug #39474 [DomCrawler] Fix null namespace issue in Crawler (prosalov)
This PR was merged into the 5.3-dev branch. Discussion ---------- [DomCrawler] Fix null namespace issue in Crawler | Q | A | ------------- | --- | Branch? | 5.x <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #39277 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | <!-- required for new features --> In this case `isset` may cause an issue if null value would be stored in `$this->namespaces` or `$this->cachedNamespaces`, but never fetched, as if condition would return false. This PR is for 5.x, because namespace caching was introduced recently (#39097). Commits ------- 7b0a183 [DomCrawler] Fix null namespace issue in Crawler
2 parents e5167e6 + 7b0a183 commit d259c84
Copy full SHA for d259c84

File tree

1 file changed

+2
-2
lines changed
Filter options

1 file changed

+2
-2
lines changed

‎src/Symfony/Component/DomCrawler/Crawler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Crawler.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,11 +1194,11 @@ private function createDOMXPath(\DOMDocument $document, array $prefixes = []): \
11941194
*/
11951195
private function discoverNamespace(\DOMXPath $domxpath, string $prefix): ?string
11961196
{
1197-
if (isset($this->namespaces[$prefix])) {
1197+
if (\array_key_exists($prefix, $this->namespaces)) {
11981198
return $this->namespaces[$prefix];
11991199
}
12001200

1201-
if (isset($this->cachedNamespaces[$prefix])) {
1201+
if ($this->cachedNamespaces->offsetExists($prefix)) {
12021202
return $this->cachedNamespaces[$prefix];
12031203
}
12041204

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.