-
Notifications
You must be signed in to change notification settings - Fork 11k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Illegal offset type in isset or empty (version: 5.7) #26045
Comments
What are the steps to reproduce it so we can add a test for the fix? |
Register -> validate registration with "MustVerifyEmail" -> logout -> go to reset password -> send request: |
|
Has this worked before? Put |
It seems that doing |
And if i do dd($key), I get: Request {#42 ▼
#json: null
#convertedFiles: []
#userResolver: Closure {#291 ▶}
#routeResolver: Closure {#298 ▶}
+attributes: ParameterBag {#44 ▶}
+request: ParameterBag {#43 ▶}
+query: ParameterBag {#50 ▶}
+server: ServerBag {#46 ▶}
+files: FileBag {#47 ▶}
+cookies: ParameterBag {#45 ▶}
+headers: HeaderBag {#48 ▶}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/password/email"
#requestUri: "/password/email"
#baseUrl: ""
#basePath: null
#method: "POST"
#format: null
#session: Store {#340 ▶}
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
} |
Are you using the default template for password reset emails? |
Im using my custom view, and same model and controller. |
Please post your view. |
@extends('layouts.empty', ['paceTop' => true, 'bodyExtraClass' => 'bg-white'])
@section('title', 'Reset Password Page')
@section('content')
<!-- begin login -->
<div class="login login-with-news-feed">
<!-- begin news-feed -->
<div class="news-feed">
<div class="news-image" style="background-image: url(/assets/panel/img/login-bg/login-bg-1.jpg)"></div>
<div class="news-caption">
<h4 class="caption-title"><b>Color</b> Admin App</h4>
<p>
Download the Color Admin app for iPhone®, iPad®, and Android™. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>
</div>
</div>
<!-- end news-feed -->
<!-- begin right-content -->
<div class="right-content">
<!-- begin login-header -->
<div class="login-header">
<div class="brand">
<span class="logo"></span> <b>Color</b> Admin
<small>responsive bootstrap 3 admin template</small>
</div>
<div class="icon">
<i class="fa fa-sign-in"></i>
</div>
</div>
<!-- end login-header -->
<!-- begin login-content -->
<div class="login-content">
<form action="{{ route('password.request') }}" method="POST" class="margin-bottom-0">
@if ($errors->has('g-recaptcha-response'))
<div class="alert alert-dark fade show m-b-10">
<span class="close" data-dismiss="alert">×</span>
The recaptcha field is required.
</div>
@endif
{{ csrf_field() }}
<input type="hidden" name="token" value="{{ $token }}">
<div class="input-group m-b-{{ $errors->has('email') ? '40' : '15' }}">
<input id="email" type="email" class="form-control form-control-lg {{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" placeholder="Email Address" value="{{ old('email') }}" required />
@if ($errors->has('email'))
<div class="invalid-tooltip">{{ $errors->first('email') }}</div>
@endif
</div>
<div class="input-group m-b-{{ $errors->has('password') ? '40' : '15' }}">
<input id="password" type="password" class="form-control form-control-lg {{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" placeholder="New Password" required />
@if ($errors->has('password'))
<div class="invalid-tooltip">{{ $errors->first('password') }}</div>
@endif
</div>
<div class="input-group m-b-{{ $errors->has('password_confirmation') ? '40' : '15' }}">
<input id="password_confirmation" type="password" class="form-control form-control-lg {{ $errors->has('password_confirmation') ? ' is-invalid' : '' }}" name="password_confirmation" placeholder="Confirm New Password" required />
@if ($errors->has('password'))
<div class="invalid-tooltip">{{ $errors->first('password_confirmation') }}</div>
@endif
</div>
{!! Recaptcha::render() !!}
<div class="m-b-10"></div>
<div class="login-buttons">
<button type="submit" class="btn btn-success btn-block btn-lg">Reset Password</button>
</div>
<div class="m-t-20 m-b-40 p-b-40 text-inverse">
Already a member? Click <a href="/login">here</a> to login.
</div>
<hr />
<p class="text-center text-grey-darker">
© Color Admin All Right Reserved 2018
</p>
</form>
</div>
<!-- end login-content -->
</div>
<!-- end right-container -->
</div>
<!-- end login -->
@endsection |
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get the response for a successful password reset link.
*
* @param string $response
* @return \Illuminate\Http\RedirectResponse
*/
public function sendResetLinkResponse($response)
{
return redirect()->route('login')->with('status', trans($response));
}
/**
* Validate the email for the given request.
*
* @param \Illuminate\Http\Request $request
* @return void
*/
protected function validateEmail(Request $request)
{
$this->validate($request, [
'email' => 'required|email',
'g-recaptcha-response' => 'required|recaptcha'
]);
}
} |
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable implements MustVerifyEmail
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
} |
I meant the password reset email, you posted the password reset page. Your error looks like it's coming from the email template. |
@extends('layouts.empty', ['paceTop' => true, 'bodyExtraClass' => 'bg-white'])
@section('title', 'Reset Password Page')
@section('content')
<!-- begin login -->
<div class="login login-with-news-feed">
<!-- begin news-feed -->
<div class="news-feed">
<div class="news-image" style="background-image: url(/assets/panel/img/login-bg/login-bg-1.jpg)"></div>
<div class="news-caption">
<h4 class="caption-title"><b>Color</b> Admin App</h4>
<p>
Download the Color Admin app for iPhone®, iPad®, and Android™. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>
</div>
</div>
<!-- end news-feed -->
<!-- begin right-content -->
<div class="right-content">
<!-- begin login-header -->
<div class="login-header">
<div class="brand">
<span class="logo"></span> <b>Color</b> Admin
<small>responsive bootstrap 3 admin template</small>
</div>
<div class="icon">
<i class="fa fa-sign-in"></i>
</div>
</div>
<!-- end login-header -->
<!-- begin login-content -->
<div class="login-content">
<form action="/password/email" method="POST" class="margin-bottom-0">
@if ($errors->has('g-recaptcha-response'))
<div class="alert alert-dark fade show m-b-10">
<span class="close" data-dismiss="alert">×</span>
The recaptcha field is required.
</div>
@endif
{{ csrf_field() }}
<div class="input-group m-b-{{ $errors->has('email') ? '40' : '15' }}">
<input id="email" type="email" class="form-control form-control-lg {{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" placeholder="Email Address" value="{{ old('email') }}" required />
@if ($errors->has('email'))
<div class="invalid-tooltip">{{ $errors->first('email') }}</div>
@endif
</div>
{!! Recaptcha::render() !!}
<div class="m-b-10"></div>
<div class="login-buttons">
<button type="submit" class="btn btn-success btn-block btn-lg">Reset Password</button>
</div>
<div class="m-t-20 m-b-40 p-b-40 text-inverse">
Already a member? Click <a href="/login">here</a> to login.
</div>
<hr />
<p class="text-center text-grey-darker">
© Color Admin All Right Reserved 2018
</p>
</form>
</div>
<!-- end login-content -->
</div>
<!-- end right-container -->
</div>
<!-- end login -->
@endsection
|
Any Idea of what is happening? If, no, is there a problem if I use the solution I provided before? |
So if you use the default email template - it works right? It's one of your variables in your email template that is not set correctly. Just do some debugging and remove all the code, and add it slowly back in until you find the problem. |
I have this same problem, only realised today after some users starting complaining. I am using the standard password reset email template. |
@rbmcgowan - can you give a reproducible example using a default laravel install? |
you mean a fresh clean install ? then no, I don't have one of those. The password reset process is out of the box though. |
@rbmcgowan When exactly does the error occur? When the user submits the |
It's failing on the second "return redirect" line in ResetPasswordController.php. The password was reset fine and works, the page just doesn't return. protected function sendResetResponse($response) |
Please post the exception stacktrace. What's your Laravel version? What do you get when you put |
|
upgraded to 5.7.9 to see if that helped, but it was 5.7.6 Request {#42 ▼ I have included the collapsed data, do you want anything in particular? One interesting behaviour, if I insert the DD in sendResetResponse, then when the DD output displays I remove the DD, hit BACK in the browser and complete the new password form again, it works fine, no error. |
You have to adjust the signature of protected function sendResetResponse(Request $request, $response) This has been changed in Laravel 5.7 (upgrade guide). |
@dalexhd You have to apply the same change to |
ah, sorry, don't know how I missed that, clearly my fault, I really appreciate your outstanding level of support. |
same problem, and solved , dut to changed in laravle new update 5.7 protected function sendResetResponse(Request $request, $response) thank you !!! |
hello guys I'm facing this issue Illegal offset type in isset or empty (version: 8.19) on Laravel 8 |
Url: "/password/email"
ErrorException
…/vendor/laravel/framework/src/Illuminate/Support/NamespacedItemResolver.php25
The text was updated successfully, but these errors were encountered: