Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DefaultFormRenderer: Fix GET Application\UI\Form #222

Merged
merged 1 commit into from
Jul 4, 2019

Conversation

jtojnar
Copy link
Contributor

@jtojnar jtojnar commented May 10, 2019

Forms\Form allows to pass stringable objects to setAction method, which is also used by Application\UI\Form to store Application\UI\Link object. DefaultFormRenderer calls string manipulation functions on the Form’s action when rendering, causing it to raise a TypeError when strict types are enabled.

To fix this, I am stringifying the action in the DefaultFormRenderer. I have opted to do it there, rather than in the Form::setAction method, in case the Link object is not ready yet at the time the Form is created.

Closes: nette/application#218

Forms\Form allows to pass stringable objects to setAction method,
which is also used by Application\UI\Form to store Application\UI\Link object.
DefaultFormRenderer calls string manipulation functions on the Form’s action
when rendering, causing it to raise a TypeError when strict types are enabled.

To fix this, I am stringifying the action in the DefaultFormRenderer.
I have opted to do it there, rather than in the Form::setAction method,
in case the Link object is not ready yet at the time the Form is created.
@dg
Copy link
Member

dg commented Jul 4, 2019

Thanks!

@dg dg merged commit b3356d0 into nette:master Jul 4, 2019
dg pushed a commit that referenced this pull request Jul 8, 2019
Forms\Form allows to pass stringable objects to setAction method,
which is also used by Application\UI\Form to store Application\UI\Link object.
DefaultFormRenderer calls string manipulation functions on the Form’s action
when rendering, causing it to raise a TypeError when strict types are enabled.

To fix this, I am stringifying the action in the DefaultFormRenderer.
I have opted to do it there, rather than in the Form::setAction method,
in case the Link object is not ready yet at the time the Form is created.
@jtojnar jtojnar deleted the object-action branch July 13, 2019 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GET form throws type error on rendering
2 participants