Skip to content

[DomCrawler] disabled form fields not reachable anymore #35923

Closed
@dmaicher

Description

@dmaicher

Symfony version(s) affected: 3.4.38, 4.4.5, 5.0.5

Description
It seems since #34059 a disabled form field is not added to the form anymore at all which seems odd.

In one of my tests I was retrieving a disabled form field and checking its value. This is not possible anymore now.

How to reproduce

<?php

use Symfony\Component\DomCrawler\Crawler;

$html = <<<HTML
<html>
    <form>
        <input type="text" name="foo" value="bar" disabled />
    </form>
</html>
HTML;

$crawler = new Crawler($html, 'http://localhost/');

dump($crawler->filter('form')->form()->get('foo')->getValue());

Works with 4.4.4 and breaks with 4.4.5: InvalidArgumentException: Unreachable field "foo"

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