fiskhandlarn / blade

:runner: A library for using Laravel Blade templates in WordPlate.
GNU General Public License v3.0
36 stars 5 forks source link

Fatal error: Uncaught Error: Call to private Dotenv\Repository\Adapter\EnvConstAdapter::__construct() #9

Closed menegain-mathieu closed 3 years ago

menegain-mathieu commented 3 years ago

Hi,

We have an error when we updated Wordplate to version 9.1 because the package updated vlucas/dotenv to 5.0 so we have : Fatal error: Uncaught Error: Call to private Dotenv\Repository\Adapter\EnvConstAdapter::__construct() from context 'Illuminate\Support\Env' in C:\laragon\www\wordplate\vendor\illuminate\support\Env.php:58 Stack trace: #0 C:\laragon\www\wordplate\vendor\illuminate\support\Env.php(81): Illuminate\Support\Env::getRepository() #1 C:\laragon\www\wordplate\vendor\illuminate\support\helpers.php(276): Illuminate\Support\Env::get('WP_PREFIX', 'wp_') #2 C:\laragon\www\wordplate\public\wp-config.php(56): env('WP_PREFIX', 'wp_') #3 C:\laragon\www\wordplate\public\wordpress\wp-load.php(42): require_once('C:\\laragon\\www\\...') #4 C:\laragon\www\wordplate\public\wordpress\wp-admin\admin.php(34): require_once('C:\\laragon\\www\\...') #5 C:\laragon\www\wordplate\public\wordpress\wp-admin\themes.php(10): require_once('C:\\laragon\\www\\...') #6 {main} thrown in C:\laragon\www\wordplate\vendor\illuminate\support\Env.php on line 58

vinkla commented 3 years ago

This could probably be solved by adding "illuminate/view": "^7.10 || ^8.0" to composer.json file. Or simple by bumping the Laravel version to 8.0.

Until this is solved you could force wordplate/framework to version 9.0.

fiskhandlarn commented 3 years ago

I have a potential fix for this (upgrade illuminate/view dependency to ^8.6 in fiskhandlarn/blade) but this would make this repo incompatible with WordPlate 9.0:

<b>Fatal error</b>:  Uncaught Error: Call to undefined method Dotenv\Repository\RepositoryBuilder::createWithDefaultAdapters() in testwordplate9\blog\vendor\illuminate\support\Env.php:55
Stack trace:
#0 testwordplate9\blog\vendor\illuminate\support\Env.php(76): Illuminate\Support\Env::getRepository()
#1 testwordplate9\blog\vendor\illuminate\support\helpers.php(132): Illuminate\Support\Env::get('WP_PREFIX', 'wp_')
#2 testwordplate9\blog\public\wp-config.php(56): env('WP_PREFIX', 'wp_')
#3 testwordplate9\blog\public\wordpress\wp-load.php(42): require_once('D:\\dokument\\pro...')
#4 testwordplate9\blog\public\wordpress\wp-blog-header.php(13): require_once('D:\\dokument\\pro...')
#5 testwordplate9\blog\public\index.ph in <b>testwordplate9\blog\vendor\illuminate\support\Env.php</b> on line <b>55</b><br />

If using WordPlate 9.0 the old trick with manually requiring vlucas/phpdotenv doesn't seem to work:

$ composer require vlucas/phpdotenv:"^5.2"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - wordplate/framework 9.0.0 requires vlucas/phpdotenv ^4.1 -> satisfiable by vlucas/phpdotenv[4.1.x-dev, v4.1.0, v4.1.1, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8] but these conflict with your requirements or minimum-stability.
    - wordplate/framework 9.0.0 requires vlucas/phpdotenv ^4.1 -> satisfiable by vlucas/phpdotenv[4.1.x-dev, v4.1.0, v4.1.1, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8] but these conflict with your requirements or minimum-stability.
    - wordplate/framework 9.0.0 requires vlucas/phpdotenv ^4.1 -> satisfiable by vlucas/phpdotenv[4.1.x-dev, v4.1.0, v4.1.1, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8] but these conflict with your requirements or minimum-stability.
    - Installation request for wordplate/framework 9.0 -> satisfiable by wordplate/framework[9.0.0].

Installation failed, reverting ./composer.json to its original content.

My suggestion is to bump the recommendation to WordPlate 9.1 for this repo (and not support 9.0 at all). What do you think, @vinkla?

vinkla commented 3 years ago

My suggestion is to bump the recommendation to WordPlate 9.1 for this repo (and not support 9.0 at all). What do you think, @vinkla?

I think bumping illuminate/view to version ^8.6 would be better. WordPlate 9.0 is already old news 😄

b4nghh commented 3 years ago

@fiskhandlarn @vinkla Hello, I just upgraded WordPlate to version 9.4 and it was broken. Any updates on this issue?

fiskhandlarn commented 3 years ago

@menegain @b4nghh I just published a new version which should fix this issue for WordPlate >= 9.0. Sorry it took so long. Please let me know if something isn't working.

b4nghh commented 3 years ago

@fiskhandlarn Just updated. It works without any problems. Thank you! 👍