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

GridFieldDetailForm_ItemRequest isn’t a Controller, yet Form treats it as one #3760

Closed
kinglozzer opened this issue Jan 7, 2015 · 5 comments

Comments

@kinglozzer
Copy link
Member

Form::__construct() expects the first parameter to be a Controller (maybe it should be type-hinted?): the class relies on methods such as Controller::redirectBack(). However, GridFieldDetailForm_ItemRequest, which is not an instance of Controller, is passed as the $controller argument here, which can cause fatal errors. For example, if the security token is invalid the form is unable to redirect back and preserve the form data.

@dhensby
Copy link
Contributor

dhensby commented Feb 17, 2015

Well, that instance of sending the ItemRequest needs to be fixed. I'm not a fan of FORCING the parameters to be specific class types (it's not a hint, it's an enforcement)

@oddnoc
Copy link
Contributor

oddnoc commented Sep 14, 2015

Today, I received an error email that seems to be related to this issue:

[Error] Uncaught Exception: Object->__call(): the method 'redirectback' does not exist on 'GridFieldDetailForm_ItemRequest'
/var/www-capistrano/silverstripe/releases/B/docroot/framework/core/Object.php:763 

@tractorcow
Copy link
Contributor

I get this error a lot during other test failures; I think this class needs to extend Controller.

@sminnee
Copy link
Member

sminnee commented May 10, 2017

The first argument to form should be a RequestHandler, not a Controller. The bug is probably that redirectBack isn't available on RequestHandler.

@tractorcow
Copy link
Contributor

tractorcow commented May 11, 2017

This is fixed in 4.0: Form now accepts a RequestHandler as a constructor argument, and RequestHandler now contains the necessary redirect handlers.

FIxed with #6692

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants