Skip to content

GET form throws type error on rendering #218

@jtojnar

Description

@jtojnar

Version: 3.0.0

After I updated to Nette 3, the GET forms no longer render.

You can reproduce it easily by minor tweak of the test:

--- a/tests/UI/Form.phpt
+++ b/tests/UI/Form.phpt
@@ -22,4 +22,6 @@
 	$presenter = new TestPresenter;
 	$form = new UI\Form($presenter, 'name');
 	$form->setMethod($form::GET); // must not throw exception
+
+	Assert::contains('<form', (string) $form);
 });

Running the test produces the following type error with PHP 7.2.18:

-- FAILED: Nette\Application\UI\Form | Form.phpt
   Exited with error code 255 (expected 0)
   E_USER_ERROR: Exception in Nette\Forms\Form::__toString(): parse_url() expects parameter 1 to be string, object given in /home/jtojnar/Projects/nette-application/vendor/nette/forms/src/Forms/Rendering/DefaultFormRenderer.php:170
   
   in src/Forms/Form.php(625) 
   in src/Forms/Form.php(625) trigger_error()
   in tests/UI/Form.phpt(26) Nette\Forms\Form->__toString()
   in nette-application/tests/bootstrap.php(27) {closure}()
   in tests/UI/Form.phpt(27) test()

It is weird, as the relevant code did not change in recent history:

https://github.com/nette/forms/blame/v3.0.0/src/Forms/Rendering/DefaultFormRenderer.php#L170
https://github.com/nette/application/blame/v3.0.0/src/Application/UI/Form.php#L45

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions