Skip to content

->form() throw exception #31644

Closed
Closed
@planetchili

Description

@planetchili

Symfony version(s) affected: "symfony/dom-crawler": "4.2"

Description
Getting exception thrown when calling form():
TypeError : Argument 2 passed to Symfony\Component\DomCrawler\Form::__construct() must be of the type string, null given

How to reproduce
$form = $crawler->filter('button.btn-class')->form();

Possible Solution
Making 2nd ctor param of Symfony\Component\DomCrawler\Form nullable fixes the problem:
public function __construct(\DOMElement $node, ?string $currentUri, string $method = null, string $baseHref = null)

Additional context
PHP 7.2.11 / Laravel 5.6.27 / PHPUnit 7.2.7

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