Skip to content

Commit

Permalink
Fixed `Argument 1 passed to Grav\Common\User\DataUser\User::filterUse…
Browse files Browse the repository at this point in the history
…rname() must be of the type string` [#1992]
  • Loading branch information
mahagr committed Dec 10, 2020
1 parent ea358c2 commit d345939
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Fixed broken list in `bin/gpm index` [#3092](https://github.com/getgrav/grav/issues/3092)
* Fixed CLI/GPM command failures returning 0 (success) value [#3017](https://github.com/getgrav/grav/issues/3017)
* Fixed unimplemented `PageObject::getOriginal()` call [#3098](https://github.com/getgrav/grav/issues/3098)
* Fixed `Argument 1 passed to Grav\Common\User\DataUser\User::filterUsername() must be of the type string` [#1992](https://github.com/getgrav/grav-plugin-admin/issues/1992)

# v1.7.0-rc.19
## 12/02/2020
Expand Down
2 changes: 2 additions & 0 deletions system/src/Grav/Common/Flex/Types/Users/UserCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public static function getCachedMethods(): array
*/
public function load($username): UserInterface
{
$username = (string)$username;

if ($username !== '') {
$key = $this->filterUsername($username);
$user = $this->get($key);
Expand Down
2 changes: 2 additions & 0 deletions system/src/Grav/Common/Flex/Types/Users/UserIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ public static function updateObjectMeta(array &$meta, array $data, FlexStorageIn
*/
public function load($username): UserInterface
{
$username = (string)$username;

if ($username !== '') {
$key = static::filterUsername($username, $this->getFlexDirectory()->getStorage());
$user = $this->get($key);
Expand Down
2 changes: 1 addition & 1 deletion system/src/Grav/Common/User/DataUser/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function save()
}

if ($file) {
$username = $this->filterUsername($this->get('username'));
$username = $this->filterUsername((string)$this->get('username'));

if (!$file->filename()) {
$locator = Grav::instance()['locator'];
Expand Down
2 changes: 2 additions & 0 deletions system/src/Grav/Common/User/DataUser/UserCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public function __construct(string $className)
*/
public function load($username): UserInterface
{
$username = (string)$username;

$grav = Grav::instance();
/** @var UniformResourceLocator $locator */
$locator = $grav['locator'];
Expand Down

0 comments on commit d345939

Please sign in to comment.