Brotzka / laravel-dotenv-editor

A Laravel package for editing the .env file dynamically.
366 stars 80 forks source link

Package RouteGroup broken after upgrade to Laravel 5.7.17 update. #62

Open TheZachh opened 5 years ago

TheZachh commented 5 years ago

As of Laravel 5.7.17, the following error occurs due to a failed syntax on the vendor/routes file for this package:

In Router.php line 366:

  Argument 1 passed to Illuminate\Routing\Router::group() must be of the type
   array, string given, called in /var/www/laravelbp/vendor/laravel/framework
  /src/Illuminate/Support/Facades/Facade.php on line 223

StackTrace `[2018-12-15 00:14:51] production.ERROR: Class Brotzka\DotenvEditor\Http\Controller\EnvController does not exist {"exception":"[object] (ReflectionException(code: -1): Class Brotzka\DotenvEditor\Http\Controller\EnvController does not exist at /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Container/Container.php:779) [stacktrace]

0 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Container/Container.php(779): ReflectionClass->__construct('Brotzka\\DotenvE...')

1 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Container/Container.php(658): Illuminate\Container\Container->build('Brotzka\\DotenvE...')

2 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Container/Container.php(609): Illuminate\Container\Container->resolve('Brotzka\\DotenvE...', Array)

3 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(735): Illuminate\Container\Container->make('Brotzka\\DotenvE...', Array)

4 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Routing/Route.php(226): Illuminate\Foundation\Application->make('Brotzka\\DotenvE...')

5 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Routing/Route.php(796): Illuminate\Routing\Route->getController()

6 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Routing/Route.php(757): Illuminate\Routing\Route->controllerMiddleware()

7 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Routing/Router.php(695): Illuminate\Routing\Route->gatherMiddleware()

8 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Routing/Router.php(675): Illuminate\Routing\Router->gatherRouteMiddleware(Object(Illuminate\Routing\Route))

9 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Routing/Router.php(659): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))

10 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Routing/Router.php(625): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))

11 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Routing/Router.php(614): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))

12 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))

13 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))

14 /var/www/laravelbp/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(58): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))

15 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle(Object(Illuminate\Http\Request), Object(Closure))

16 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

17 /var/www/laravelbp/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))

18 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))

19 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

20 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))

21 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))

22 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

23 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))

24 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))

25 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

26 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))

27 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))

28 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

29 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(62): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))

30 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))

31 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

32 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))

33 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))

34 /var/www/laravelbp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))

35 /var/www/html/index.php(46): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))

36 {main}

"} `

In Routes/web.php, you have:

<?php
/**
 * Created by PhpStorm.
 * User: Fabian
 * Date: 19.07.16
 * Time: 06:04
 */
if (config('dotenveditor.activated')) {
    Route::group(
        config('dotenveditor.route'),
        function () {
            Route::get('/', 'EnvController@overview')->name('index');
            Route::post('/add', 'EnvController@add')->name('add');
            Route::post('/update', 'EnvController@update')->name('update');
            Route::get('/createbackup', 'EnvController@createBackup')->name('createbackup');
            Route::get('/deletebackup/{timestamp}', 'EnvController@deleteBackup')->name('deletebackup');
            Route::get('/restore/{backuptimestamp}', 'EnvController@restore')->name('restore');
            Route::post('/delete', 'EnvController@delete')->name('delete');
            Route::get('/download/{filename?}', 'EnvController@download')->name('download');
            Route::post('/upload', 'EnvController@upload')->name('upload');
            Route::get('/getdetails/{timestamp?}', 'EnvController@getDetails')->name('getdetails');
        }
    );
}

So it seems this is using a deprecated group syntax that is no longer valid, because it worked fine before the update. Tweaking the routes file by adding [] where needed, resolves the error but the package breaks so ultimately I had to remove it until an official patch is out.

Thanks for this awesome package. I used it all the time. Hope this helps with new updates!

GeoSot commented 5 years ago

@TheZachh

Check in your project config/dotenveditor.php and align it with this config

I guess you have published the config file and the latest version has changed some things inside (like 'route' from string to array)