mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX #6066 Form::__construct() should respect hasMethod on passed in Controller instance if it's available (thanks paradigmincarnate!)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@111890 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
5453c1a99d
commit
f2388d49d9
@ -167,7 +167,7 @@ class Form extends RequestHandler {
|
|||||||
|
|
||||||
// Check if CSRF protection is enabled, either on the parent controller or from the default setting. Note that
|
// Check if CSRF protection is enabled, either on the parent controller or from the default setting. Note that
|
||||||
// method_exists() is used as some controllers (e.g. GroupTest) do not always extend from Object.
|
// method_exists() is used as some controllers (e.g. GroupTest) do not always extend from Object.
|
||||||
if(method_exists($controller, 'securityTokenEnabled')) {
|
if(method_exists($controller, 'securityTokenEnabled') || (method_exists($controller, 'hasMethod') && $controller->hasMethod('securityTokenEnabled'))) {
|
||||||
$this->security = $controller->securityTokenEnabled();
|
$this->security = $controller->securityTokenEnabled();
|
||||||
} else {
|
} else {
|
||||||
$this->security = self::$default_security;
|
$this->security = self::$default_security;
|
||||||
|
Loading…
Reference in New Issue
Block a user