-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
Trying to access array offset on value of type null #30737
Comments
We'll need more information than this. Is this a fresh Laravel app. What's the stack trace? |
Please provide some code |
The current situation is due to access to the default home page after the PHP version has been upgraded to version 7.4. |
Having the same issue. I have a model with a jsonb field that is casted to an array, like this.
In PHP 7.3, when I dump the model, 'data' is an array (as expected). In PHP 7.4, 'data' is null. Edit: Didn't notice the Laravel version on first post. I'm on Laravel 6.5.1 |
It Laravel 5.7 supposed to work with PHP 7.4? |
I didn't catch the version here. 5.7 indeed doesn't supports PHP 7.4 and isn't maintained anymore. Please check out our support policy on which versions we are currently supporting. |
Edit: Please disregard this. I'm not being able to reproduce the issue on a fresh install on Laravel. The issue might be somewhere else. |
I'm having the same issue when using laravel 6 with php 7.4 Step to reproduce in your controller create new instance of any model and pass it to view something like $banner = new Banner();
return view('back.banners.create', compact('banner')); and in your view try to use old helper something like old('title.en', $banner->title['en']) Workaround to use the optional helper to ignore the error produced by php 7.4 old('title.ar', optional($banner->title)['en']) in php 7.3 this was not an issue and the code worked fine I think the old helper need adjustment for php 7.4 to work like the old behaviour |
According to PHP-Doc this is a Backwards Incompatible Change
|
some note
|
Had following configurations:
downgrading to php 7.2 worked for me |
Maybe in some case you try composer update first. |
I was having this same "Trying to access array offset on value of type null." problem, and it referenced This start happening for me after I upgraded my server to PHP 7.4. And it was for a Laravel 5.8 (not 5.7) app. Upgrading to Laravel 6.x seemed to fix it. |
this issue happened for me on laravel 5.8 on php 7.4. Downgrading the php to 7.3 fixed it. |
@agharium 5.8 doesn't supports 7.4 |
@driesvints learned it the hard way. |
same issue |
Hey everyone, I'm locking this issue because it either has gone off-topic, become a dumping ground for things which shouldn't be in an issue tracker or is just too old. Please try to discuss things further on one of the below channels: |
Description:
Trying to access array offset on value of type null
Steps To Reproduce:
Perform any access or execute the 'php artisan' command
The text was updated successfully, but these errors were encountered: