BUGFIX #6066 Form::__construct() should respect hasMethod on passed in Controller instance if it's available (thanks paradigmincarnate!) (from r111890)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112940 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-10-19 05:04:58 +00:00
parent bb183add33
commit b40544e694

View File

@ -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
// 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();
} else {
$this->security = self::$default_security;