framework: Unexpected argument exception within login process
- 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?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (16 by maintainers)
Closing since the PR was merged: https://github.com/laravel/framework/pull/18746
Thanks 😃
If you are talking about this https://github.com/laravel/laravel/pull/4212 as I understand it fixes only registration, but login is fixed by this https://github.com/webmake/framework/pull/1/files or not? o.O Maybe I didn’t find proper place to validate, but by default there is no array in forms, so might arrise error as in my case