Closed Twansparant closed 2 years ago
If I add php version 7.4 to the platform config in my theme's composer.json:
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"platform": {
"php": "7.4"
}
},
And after run:
rm -rf vendor && rm composer.lock && composer install
The error is gone and running wp @development acorn optimize
runs without error:
Configuration cache cleared!
Configuration cached successfully!
Files cached successfully!
If I remove the php version from my config, the same command results in the error as described:
Configuration cache cleared!
Configuration cached successfully!
Fatal error: Declaration of Illuminate\Log\LogManager::emergency($message, array $context = []) must be compatible with Psr\Log\LoggerInterface::emergency(Stringable|string $message, array $context = []): void in /srv/www/mydomain/current/vendor/illuminate/log/LogManager.php on line 546
Fatal error: Uncaught Error: Class "Illuminate\Log\LogManager" not found in /srv/www/mydomain/current/vendor/illuminate/log/LogServiceProvider.php:17
Stack trace:
#0 /srv/www/mydomain/current/vendor/illuminate/container/Container.php(873): Illuminate\Log\LogServiceProvider->Illuminate\Log\{closure}(Object(Roots\Acorn\Application), Array)
#1 /srv/www/mydomain/current/vendor/illuminate/container/Container.php(758): Illuminate\Container\Container->build(Object(Closure))
#2 /srv/www/mydomain/current/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(851): Illuminate\Container\Container->resolve('log', Array, true)
#3 /srv/www/mydomain/current/vendor/illuminate/container/Container.php(694): Illuminate\Foundation\Application->resolve('log', Array)
#4 /srv/www/mydomain/current/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(836): Illuminate\Container\Container->make('log', Array)
#5 /srv/www/mydomain/current/vendor/roots/acorn/src/Illuminate/Foundation/Exceptions/Handler.php(242): Illuminate\Foundation\Application->make('log')
#6 /srv/www/mydomain/current/vendor/roots/acorn/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(162): Illuminate\Foundation\Exceptions\Handler->report(Object(Symfony\Component\ErrorHandler\Error\FatalError))
#7 /srv/www/mydomain/current/vendor/roots/acorn/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(204): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\ErrorHandler\Error\FatalError))
#8 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
#9 {main}
thrown in /srv/www/mydomain/current/vendor/illuminate/log/LogServiceProvider.php on line 17
Error: Cannot connect over SSH using provided configuration.
This seems like it's an upstream issue that's out of my control.
The good news is that I think it's been fixed in PHP v8.1.6
I still don't understand this bug to be honest... My Trellis servers run php 8.0, my local machine currently runs php 8.1.9 (I upgraded from 8.1.4) and I'm still getting this bug?
In my composer.json
I define the php platform like this:
...
"require": {
"php": ">=7.1",
"composer/installers": "^2.1",
"vlucas/phpdotenv": "^5.4",
"oscarotero/env": "^2.1",
"roots/acorn": "^2.1",
"roots/bedrock-autoloader": "^1.0",
"roots/bedrock-disallow-indexing": "^2.0",
"roots/wordpress": "^6.0",
"roots/wp-config": "^1.0",
"roots/wp-password-bcrypt": "^1.1",
...
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.6.0",
"roave/security-advisories": "dev-latest"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"allow-plugins": {
"ffraenz/private-composer-installer": true,
"junaidbhura/composer-wp-pro-plugins": true,
"composer/installers": true,
"roots/wordpress-core-installer": true
},
"platform": {
"php": "8.0"
}
},
...
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-autoload-dump": [
"Roots\\Acorn\\ComposerScripts::postAutoloadDump"
],
"test": [
"phpcs"
]
}
So what is triggering this bug? Can I only get rid of this bug by using php 8.1 on my servers too? Or should I use the special acorn-v2.1.2-php-8.0.zip?
Because I did try that by defining the repository like this:
{
"type": "package",
"package": {
"name": "roots/acorn",
"version": "2.1.2",
"type": "library",
"dist": {
"url": "https://github.com/roots/acorn/releases/download/v2.1.2/acorn-v2.1.2-php-8.0.zip",
"type": "zip"
}
}
},
But then I get the You need to install Acorn to use this theme.
message because it can't use the post-autoload-dump
script:
Class Roots\Acorn\ComposerScripts is not autoloadable, can not call post-autoload-dump script
And if I remove the platform:
"platform": {
"php": "8.0"
}
I get this error:
Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.15. in /srv/www/cms.clarify.nl/current/vendor/composer/platform_check.php on line 24
When I update the php version to 8.1 in trellis, re-provision, remove the composer platform and run composer update, I get so many deprecation errors from wordpress plugins PLUS the same fatal error Class "Illuminate\Log\LogManager" not found
that I quickly rolled back to php 8.0...
Another thing I tried was using brew-php-switcher and brew install php@8.0
and switch to php 8.0 locally with brew-php-switcher 8.0
, but even then I'm getting this error in Acorn 2.1? I even tried installing all Acorn 2.x versions, but all have the same result.
It should be possible to install Acorn with Composer on a server with php 8.0 right? Any insight would be very helpful, thanks!
So in the end I tried installing the 3.0.0-alpha.3
Acorn version and tweaked my Sage's functions.php
accordingly and that DID work...
I don't even need to use php 8.0 locally as long as I define the platfor correctly like this:
"platform": {
"php": "8.0.2"
}
Terms
Description
What's wrong?
I changed some code in my sage 10 theme and all of a sudden I get this fatal error:
What have you tried?
• I tried downgrading Acorn to 2.0.4 • Run
composer update
• Check if thatLogManager
class is actually there (and it is)What insights have you gained?
I bumped into this topic: https://laracasts.com/discuss/channels/servers/class-logmanager-not-found-in-logserviceprovider-after-upgrade-to-php81 and read it's related to PHP 8.1 which I'm also running, but that it should be resolved with Laravel 8.76+, I've got versions v8.83.6 installed.
Possible solutions
Try to install PHP 8.0 version with
phpenv
.Steps To Reproduce
Expected Behavior
I expect the error to be logged with the
LogManager
.Actual Behavior
No error is logged, but instead I get the fatal error.
Relevant Log Output
Versions
PHP 8.1.4 Composer 2.2.10 Sage 10.1.2 Acorn 2.0.5