Home > Mobile >  ErrorException: Trying to access array offset on value of type null
ErrorException: Trying to access array offset on value of type null

Time:12-15

I have a error in laravel

ErrorException: Trying to access array offset on value of type null

i use php 7.4 and I get the following error

Next ErrorException: Trying to access array offset on value of type null (View: /var/www/html/resources/views/admin/install/steps.blade.php) (View: /var/www/html/resources/views/admin/install/steps.blade.php) (View: /var/www/html/resources/views/admin/install/steps.blade.php) in /var/www/html/storage/framework/views/2d3a44bc043a42321af3d3eaee6ab680:23
Stack trace:
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(44): Illuminate\View\Engines\CompilerEngine->handleViewException()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(58): Illuminate\View\Engines\PhpEngine->evaluatePath()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/View/View.php(147): Illuminate\View\Engines\CompilerEngine->get()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/View/View.php(118): Illuminate\View\View->getContents()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/View/View.php(83): Illuminate\View\View->renderContents()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Response.php(51): Illuminate\View\View->render()
#6 /var/www/html/vendor/symfony/http-foundation/Response.php(202): Illuminate\Http\Response->setContent()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1229): Symfony\Component\HttpFoundation\Response->__construct()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(112): Illuminate\Routing\Router->prepareResponse()
#9 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func()
#11 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): call_user_func()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(114): Illuminate\Pipeline\Pipeline->then()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(68): Illuminate\Routing\ControllerDispatcher->callWithinStack()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(203): Illuminate\Routing\ControllerDispatcher->dispatch()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(134): Illuminate\Routing\Route->runWithCustomDispatcher()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(708): Illuminate\Routing\Route->run()
#18 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func()
#20 /var/www/html/app/Http/Middleware/IsInstalled.php(23): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#21 [internal function]: App\Http\Middleware\IsInstalled->handle()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array()
#23 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): call_user_func()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(710): Illuminate\Pipeline\Pipeline->then()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(674): Illuminate\Routing\Router->runRouteWithinStack()
#27 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(635): Illuminate\Routing\Router->dispatchToRoute()
#28 /var/www/html/bootstrap/cache/compiled.php(2310): Illuminate\Routing\Router->dispatch()
#29 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func()
#31 /var/www/html/app/Http/Middleware/SetLanguage.php(35): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#32 [internal function]: App\Http\Middleware\SetLanguage->handle()
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array()
#34 /var/www/html/app/Http/Middleware/EmptyCharacterIfServerOffline.php(25): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#35 [internal function]: App\Http\Middleware\EmptyCharacterIfServerOffline->handle()
#36 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array()
#37 /var/www/html/app/Http/Middleware/ApplicationEnabled.php(36): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#38 [internal function]: App\Http\Middleware\ApplicationEnabled->handle()
#39 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array()
#40 /var/www/html/app/Http/Middleware/NotInstalled.php(23): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#41 [internal function]: App\Http\Middleware\NotInstalled->handle()
#42 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array()
#43 /var/www/html/bootstrap/cache/compiled.php(2925): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#44 [internal function]: Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle()
#45 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array()
#46 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#47 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle()
#48 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array()
#49 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(62): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#50 [internal function]: Illuminate\Session\Middleware\StartSession->handle()
#51 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array()
#52 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#53 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle()
#54 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array()
#55 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#56 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle()
#57 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array()
#58 /var/www/html/bootstrap/cache/compiled.php(2982): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#59 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle()
#60 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array()
#61 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#62 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): call_user_func()
#63 /var/www/html/bootstrap/cache/compiled.php(2257): Illuminate\Pipeline\Pipeline->then()
#64 /var/www/html/bootstrap/cache/compiled.php(2240): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
#65 /var/www/html/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle()
#66 {main}  

in steps.blade.php is like this :

<div >
    <div >
        <div >
            <div >1</div>
            <div >{{ trans( 'install.welcome.title' ) }}</div>
        </div>
        <div >
            <div >2</div>
            <div >{{ trans( 'install.settings.title' ) }}</div>
        </div>
        <!--<div >
            <div >2</div>
            <div >{{ trans( 'install.environment.title' ) }}</div>
        </div>
        <div >
            <div >3</div>
            <div >{{ trans( 'install.requirements.title' ) }}</div>
        </div>
        <div >
            <div >4</div>
            <div >{{ trans( 'install.permissions.title' ) }}</div>
        </div> -->
        <div >
            <div >3</div>
            <div >{{ trans( 'install.complete.title' ) }}</div>
        </div>
    </div>
</div>





how i fix it?

I keep getting the error when trying to use the project in composer Whoops, looks like something went wrong.

there is some problem in the new version of php but I don't know how to update these lines

CodePudding user response:

session( 'message' ) is null so when you use session( 'message' )['status'] === 'success' you get that error.

Verify the array exists before using it

<div >

CodePudding user response:

You could also use the native 'dot' notation to retrieve the 'status' element from 'message' to avoid the error of trying to access null as an array:

session('message.status') === 'success'
  • Related