Skip to content

[DomCrawler] Selecting attribute 2.8 BC break  #16417

@boekkooi

Description

@boekkooi

As I was updating one of my packages I noticed that the test where all failing with 2.8.
After some research I found out that the DomCrawler was not working as expected when selecting a attribute using //div/@id.

I created the following test for CrawlerTest.php that shows the break:

    public function testFilterXPathAttribute()
    {
        $crawler = $this->createTestCrawler();

        $formIds = $crawler->filterXPath('//form/@action');
        $this->assertCount(1, $formIds, '->filterXPath() finds node attributes');
        $this->assertEquals('foo', $formIds->html(), '->filterXPath() returns the html of the found attribute');

        $divIds = $crawler->filterXPath('//form/@id');
        $this->assertCount(1, $divIds, '->filterXPath() finds node attributes');
        $this->assertEquals('FooFormId', $divIds->html(), '->filterXPath() returns the html of the first attribute');
    }

This BC break was introduced by #16058. (commit 9f362a1)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      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