diff --git a/filesystem/Upload.php b/filesystem/Upload.php index d257b260b..8ff8d965c 100644 --- a/filesystem/Upload.php +++ b/filesystem/Upload.php @@ -510,12 +510,10 @@ class Upload_Validator { if ($category && isset($this->allowedMaxFileSize['[' . $category . ']'])) { return $this->allowedMaxFileSize['[' . $category . ']']; } + } - return false; - } else { return (isset($this->allowedMaxFileSize['*'])) ? $this->allowedMaxFileSize['*'] : false; } - } /** * Set filesize maximums (in bytes or INI format). diff --git a/forms/HeaderField.php b/forms/HeaderField.php index 705e5b71e..a9a7d5a01 100644 --- a/forms/HeaderField.php +++ b/forms/HeaderField.php @@ -72,6 +72,8 @@ class HeaderField extends DatalessField { array( 'id' => $this->ID(), 'class' => $this->extraClass(), + 'type' => null, + 'name' => null ) ); } diff --git a/model/UnsavedRelationList.php b/model/UnsavedRelationList.php index 0965b51f3..6f816fa3b 100644 --- a/model/UnsavedRelationList.php +++ b/model/UnsavedRelationList.php @@ -13,8 +13,6 @@ use SilverStripe\Model\Relation; * of $dataClass). Unsaved objects are then written when the list is saved * into an instance of {@link RelationList}. * - * Most methods that alter the list of objects throw LogicExceptions. - * * @package framework * @subpackage model */ @@ -51,6 +49,8 @@ class UnsavedRelationList extends ArrayList implements Relation { /** * Create a new UnsavedRelationList * + * @param array $baseClass + * @param string $relationName * @param string $dataClass The DataObject class used in the relation */ public function __construct($baseClass, $relationName, $dataClass) { @@ -63,7 +63,8 @@ class UnsavedRelationList extends ArrayList implements Relation { /** * Add an item to this relationship * - * @param $extraFields A map of additional columns to insert into the joinTable in the case of a many_many relation + * @param mixed $item + * @param array $extraFields A map of additional columns to insert into the joinTable in the case of a many_many relation */ public function add($item, $extraFields = null) { $this->push($item, $extraFields); @@ -87,6 +88,7 @@ class UnsavedRelationList extends ArrayList implements Relation { * Pushes an item onto the end of this list. * * @param array|object $item + * @param array $extraFields */ public function push($item, $extraFields = null) { if((is_object($item) && !$item instanceof $this->dataClass) @@ -165,6 +167,8 @@ class UnsavedRelationList extends ArrayList implements Relation { * Remove the items from this list with the given IDs * * @param array $items + * @param array $items + * @return $this */ public function removeMany($items) { $this->items = array_diff($this->items, $items); @@ -255,7 +259,7 @@ class UnsavedRelationList extends ArrayList implements Relation { /** * Returns a copy of this list with the relationship linked to the given foreign ID. - * @param $id An ID or an array of IDs. + * @param int|array $id An ID or an array of IDs. */ public function forForeignID($id) { $class = singleton($this->baseClass); diff --git a/security/Security.php b/security/Security.php index d784fe23d..31822dfd2 100644 --- a/security/Security.php +++ b/security/Security.php @@ -275,9 +275,12 @@ class Security extends Controller implements TemplateGlobalProvider { $form = $me->LoginForm(); $form->sessionMessage($message, 'warning'); Session::set('MemberLoginForm.force_message',1); - $formText = $me->login(); + $loginResponse = $me->login(); + if($loginResponse instanceof SS_HTTPResponse) { + return $loginResponse; + } - $response->setBody($formText); + $response->setBody((string)$loginResponse); $controller->extend('permissionDenied', $member); @@ -502,7 +505,7 @@ class Security extends Controller implements TemplateGlobalProvider { * For multiple authenticators, Security_MultiAuthenticatorLogin is used. * See getTemplatesFor and getIncludeTemplate for how to override template logic * - * @return string Returns the "login" page as HTML code. + * @return string|SS_HTTPResponse Returns the "login" page as HTML code. */ public function login() { // Check pre-login process diff --git a/tests/core/manifest/fixtures/configmanifest/mysite/_config/empty.yml b/tests/core/manifest/fixtures/configmanifest/mysite/_config/empty.yml new file mode 100644 index 000000000..e69de29bb diff --git a/tests/core/manifest/fixtures/configmanifest/mysite/_config/namedempty.yml b/tests/core/manifest/fixtures/configmanifest/mysite/_config/namedempty.yml new file mode 100644 index 000000000..7ce2d4818 --- /dev/null +++ b/tests/core/manifest/fixtures/configmanifest/mysite/_config/namedempty.yml @@ -0,0 +1,3 @@ +--- +Name: emptyconfig +--- diff --git a/tests/filesystem/UploadTest.php b/tests/filesystem/UploadTest.php index 84d56ce10..cc802b8fe 100644 --- a/tests/filesystem/UploadTest.php +++ b/tests/filesystem/UploadTest.php @@ -187,6 +187,13 @@ class UploadTest extends SapphireTest { $retrievedSize = $v->getAllowedMaxFileSize('txt'); $this->assertEquals(4096, $retrievedSize, 'Max file size check on instance values failed (instance extension set check)'); + // Check a wildcard max file size against a file with an extension + $v = new UploadTest_Validator(); + $v->setAllowedMaxFileSize(2000); + + $retrievedSize = $v->getAllowedMaxFileSize('.jpg'); + $this->assertEquals(2000, $retrievedSize, 'Max file size check on instance values failed (wildcard max file size)'); + Config::unnest(); }