jlrdw's avatar
Level 75

Updated from 6.* to 7.0

Folks I just updated, I followed my guide:

https://laracasts.com/discuss/channels/guides/update-upgrade-laravel-then-framework

I updated laravel first, not framework but laravel.

Ran composer update.

The only problem I had was one error: Attribute [auth] does not exist.

But no problem, I then ran:

composer require laravel/ui "^2.0"

All was fixed, installed and good to go. Zero other problems.

Remember, update laravel first, not framework.

Took 17 minutes. This was development, I am sure a server would take longer with the git pushing, etc.

0 likes
10 replies
Snapey's avatar

You have to wait until all the packages you use are 7.x ready.

Check the repo for tymon/jwt-auth

EdTheDuck's avatar

After following all the steps on the upgrade guide I get the following error when I run composer update:

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255

I've tried deleting the cache files, checking my code for any errors in any files, even removed all non-core packages in case 1 of those was causing the error, but no luck.

I'm running php version 7.2.18, so should be above the requirements for that also, and have also tried the classic of deleting the entire vendor folder and running composer install again..

I'm not entirely sure what "update laravel first, not framework" means, so I may have missed something there?

Anyone have any ideas?

2 likes
ajithlal's avatar

got an error on the package beyondcode/laravel-dump-server while updating from 6.* to 7.0

ian_h's avatar

@edtheduck What was the rest of the error?

The first I had (also resulting in a 255 error code) was the documented Exception -> Throwable change that's required:

PHP Fatal error:  Declaration of App\Exceptions\Handler::report(Exception $exception) must be compatible with Illuminate\Foundation\Exceptions\Handler::report(Throwable $e) in /application/src/app/Exceptions/Handler.php on line 35

This is explained in the https://laravel.com/docs/7.x/upgrade#symfony-5-related-upgrades part of the upgrade info.

You can fix this and re-run composer update again.

Hope this is the fix for you.

Cheers..

Ian

EdTheDuck's avatar

@ian_h Thanks for the reply.

The console actually only has the error I posted, nothing else.

I'm pretty sure I changed the exception to Throwable, but I will go through the whole process again later and see if I have missed anything.

Update: I had indeed missed a Throwable type in the exception handler, and it's now working. Thanks once again.

1 like
JonStewart's avatar
Level 1

Thanks for asking that question! I was in the same boat, but clueless!

"There's no such thing as a stupid question, just a stupid person." - Bart Simpson

teos_97's avatar

I was getting exactly the same error just now,

I changed the handler to accept instances of Throwable instead of Exception as per the documention, then in the sessions i changed the 'secure' default to null, cleared the cache in bootstrap/cache/ and run composer update. This fixed my issues

seanmayerz's avatar

I found for some reason my authentication scaffolding did not install fully.. so I just ran this again.

composer require laravel/ui

And this fixed my issue (Running Laravel 7.4).

alwismt's avatar
Hey, Did you fixed your problem?

Here is the answer,

You should follow the bellow steps,

First you should you have laravel version ^6

then open your composer.json


// add laravel/ui under require-dev
"require-dev": {
//some other packages, Do not change them
        "laravel/ui": "^2.0"
    },



After that you have to follow official upgrade page instruction, Im mention them here,

Update your laravel/framework dependency to ^7.0 in your composer.json file. In addition, update your nunomaduro/collision dependency to ^4.1, phpunit/phpunit dependency to ^8.5, laravel/tinker dependency to ^2.0, and facade/ignition to ^2.0.

Then run 


composer update




After run composer update your packages will update, but exactly you will get error


​
Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255




Here is the way how to fix this error,

First open App / Exception / Handler.php

Now you have to change few codes there,




//Add
Use Throwable;
 
//change
public function report(Exception $exception)
//to
public function report(Throwable $exception)

//change
public function render($request, Exception $exception)
//to
public function render($request, Throwable $exception)



Final output Handle.php should be,




<?php

namespace App\Exceptions;

use Exception;
Use Throwable;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{
    /**
     * A list of the exception types that are not reported.
     *
     * @var array
     */
    protected $dontReport = [
        //
    ];

    /**
     * A list of the inputs that are never flashed for validation exceptions.
     *
     * @var array
     */
    protected $dontFlash = [
        'password',
        'password_confirmation',
    ];

    /**
     * Report or log an exception.
     *
     * @param  \Exception  $exception
     * @return void
     */
    //public function report(Exception $exception)
    public function report(Throwable $exception)
    {
        parent::report($exception);

    }

    


    /**
     * Render an exception into an HTTP response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Exception  $exception
     * @return \Illuminate\Http\Response
     */

    //public function render($request, Exception $exception)
    public function render($request, Throwable $exception)
    {
        return parent::render($request, $exception);
    }
}





After open Config / Session.php 





//change 
'secure' => env('SESSION_SECURE_COOKIE', false),
 //to
'secure' => env('SESSION_SECURE_COOKIE', null),





Finally clear the cache (Boostrap and seasion cache)


Now your done to go!!

Now run again




composer upate




this time you will generate auto dump without any problem 

:) :)

Please or to participate in this conversation.