Skip to content

Unexpected argument exception within login process #18697

@webmake

Description

@webmake
  • Laravel Version: 5.2.45 till 5.4.17
  • PHP Version: 7.1

Description:

[2017-04-06 20:52:09] local.ERROR: ErrorException: mb_strtolower() expects parameter 1 to be string, array given in /www/vendor/laravel/framework/src/Illuminate/Support/Str.php:182
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'mb_strtolower()...', '/www/...', 182, Array)
#1 /www/vendor/laravel/framework/src/Illuminate/Support/Str.php(182): mb_strtolower(Array, 'UTF-8')
#2 /www/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ThrottlesLogins.php(92): Illuminate\Support\Str::lower(Array)
#3 /www/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ThrottlesLogins.php(22): App\Http\Controllers\LoginController->throttleKey(Object(Illuminate\Http\Request))
#4 /www/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php(35): App\Http\Controllers\LoginController->hasTooManyLoginAttempts(Object(Illuminate\Http\Request))
#5 [internal function]: App\Http\Controllers\LoginController->login(Object(Illuminate\Http\Request))
... 

due security issues cannot provide full stack trace.

Steps To Reproduce:

Include in any controller AuthenticatesUsers trait, and provide such values:

       $this->post('/admin', [
            'email' => [$user->email],
            'password' => $password
        ]);

To sum up, AuthenticatesUsers has method login, which calls ThrottlesLogins trait to get the key throttleKey, but username method extracts 'email' field, which was array, so lower gives exception.

How to filter properly before the trait?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions