Jump to content

Update failed 8.2.1 -> 9.0.0 // ($envKey) must be of type string, bool given


Chris_675

Recommended Posts

Hello,
I received the following error while updating from v8.2.1 to 9.0.0:

Quote

/var/www/vhosts/%%%/testumgebung/vendor/symfony/dotenv/Dotenv.php line 43 - TypeError: Symfony\Component\Dotenv\Dotenv::__construct(): Argument #1 ($envKey) must be of type string, bool given, called in /var/www/vhosts/%%%/testumgebung/modules/ps_edition_basic/src/Controller/AdminPsEditionBasicPsAcademyController.php on line 32

bool instead of string?
can I find and correct envKey?

 

additional:

Quote

It seems there was an issue with the server. This type of error usually happens when: The server is temporarily unavailable. There's a misconfiguration or unexpected problem on the server.

HTTP request failed. Type: ERR_BAD_RESPONSE - HTTP Code: 500

 

It seems as if the first mistake is the most serious one.
The folders and files associated with ‘Dotenv’ are imported for the first time during the update and appear to be a new feature in version 9.

 

My Serverconfig:

Serverdaten
Serverdaten Linux #1 SMP Thu Jun 1 16:49:27 UTC 2023 x86_64
Version der Server-Software Apache
PHP-Version 8.1.19
Speichergrenze 768M
max_execution_time: 900
Upload (max. Dateigröße) 256M


Datenbank
MySQL-Version 8.0.26-16
MySQL-Server 127.0.0.1:3307
Tabellen-Präfix: ps_
MySQL-Engine MySQL
MySQL-Treiber DbPDO


Shop-Einstellungen
PrestaShop-Version 8.2.1

 

Thanks for following help :)

1.png

2.png

3.png

Link to comment
Share on other sites

This isn’t a server/env var you need to “fix” — it’s a module incompatibility.  below are 3 options

What’s happening

  • In PrestaShop 8.x, Symfony’s Dotenv constructor signature was: new Dotenv(false); // bool $usePutenv
  • In PrestaShop 9 (Symfony upgraded), the constructor signature changed to: new Dotenv(string $envKey = 'APP_ENV', string $debugKey = 'APP_DEBUG');

The ps_edition_basic module still calls new Dotenv(false) (old style), so PHP throws:

Argument #1 ($envKey) must be of type string, bool given

That’s why you get the 500/ERR_BAD_RESPONSE. The Dotenv files being “new in v9” isn’t the issue—the module code is outdated for v9.

1) Disable the offending module

Via FTP/SSH: rename the folder to disable it:

  • modules/ps_edition_basic → modules/ps_edition_basic.DISABLED
  • Clear cache
  • Reload BO/FO. If it loads, you’ve confirmed the problem.

2. Patch the module (temporary)
If you want to keep it active until there’s an update, edit:

modules/ps_edition_basic/src/Controller/AdminPsEditionBasicPsAcademyController.php

Around line ~32 you’ll see something like:

  • use Symfony\Component\Dotenv\Dotenv; // ... $dotenv = new Dotenv(false); // old signature → breaks on PS 9
  • Change to either of these (both OK on Symfony used by PS 9):
  • $dotenv = new Dotenv(); // simplest // or $dotenv = new Dotenv('APP_ENV', 'APP_DEBUG'); // explicit keys

3) Removing ps_edition_basic on PS 9
ps_edition_basic is tied to the “Basic Edition” experience and has had several PS-version quirks. On PS 9, it’s safe (and recommended) to uninstall/remove it if you’re not explicitly relying on its features.  (note you can not uninstall it, in option 1 you can just rename it.

 

Long term: update or remove ps_edition_basic for PrestaShop 9 compatibility.

 

 

Edited by El Patron (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...

Hello and thank you for your help.
Uninstalling ps_edition_basic and clearing the cache solved the ($envKey) problem. Thanks!

 

Now I have the following problem, for which I have not yet found a solution. It would be nice if you could also help me with some advice here:

(part of update log:)

[2025-09-15 16:35:08] CRITICAL - ErrorHandler - /var/www/vhosts/URL/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php line 119 - Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The service "prestashop.adapter.order.command_handler.add_product_to_order_handler" has a dependency on a non-existent service "Symfony\Component\Translation\TranslatorInterface". Did you mean one of these: "Symfony\Contracts\Translation\TranslatorInterface", "PrestaShopBundle\Translation\TranslatorInterface"?
#0 /var/www/vhosts/URL/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php(126): Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass@anonymous->processValue(Object(Symfony\Component\DependencyInjection\Reference), true)
#1 /var/www/vhosts/URL/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php(86): Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->throwServiceNotFoundException(Object(Symfony\Component\DependencyInjection\Reference), 'prestashop.adap...', Object(Symfony\Component\DependencyInjection\Reference))
#2 /var/www/vhosts/URL/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php(90): Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processValue(Object(Symfony\Component\DependencyInjection\Reference), false)
#3 /var/www/vhosts/URL/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php(51): Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->processValue(Array, false)
#4 /var/www/vhosts/URL/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php(99): Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processValue(Array)
#5 /var/www/vhosts/URL/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php(51): Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->processValue(Object(Symfony\Component\DependencyInjection\Definition), true)
#6 /var/www/vhosts/URL/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php(90): Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processValue(Object(Symfony\Component\DependencyInjection\Definition), true)
#7 /var/www/vhosts/URL/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php(51): Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->processValue(Array, true)
#8 /var/www/vhosts/URL/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php(48): Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processValue(Array, true)
#9 /var/www/vhosts/URL/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php(42): Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->process(Object(Symfony\Component\DependencyInjection\ContainerBuilder))
#10 /var/www/vhosts/URL/vendor/symfony/dependency-injection/Compiler/Compiler.php(80): Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->process(Object(Symfony\Component\DependencyInjection\ContainerBuilder))
#11 /var/www/vhosts/URL/vendor/symfony/dependency-injection/ContainerBuilder.php(767): Symfony\Component\DependencyInjection\Compiler\Compiler->compile(Object(Symfony\Component\DependencyInjection\ContainerBuilder))
#12 /var/www/vhosts/URL/vendor/symfony/http-kernel/Kernel.php(507): Symfony\Component\DependencyInjection\ContainerBuilder->compile()
#13 /var/www/vhosts/URL/vendor/symfony/http-kernel/Kernel.php(772): Symfony\Component\HttpKernel\Kernel->initializeContainer()
#14 /var/www/vhosts/URL/vendor/symfony/http-kernel/Kernel.php(126): Symfony\Component\HttpKernel\Kernel->preBoot()
#15 /var/www/vhosts/URL/app/AppKernel.php(96): Symfony\Component\HttpKernel\Kernel->boot()
#16 /var/www/vhosts/URL/modules/autoupgrade/classes/UpgradeTools/SymfonyAdapter.php(61): AppKernel->boot()
#17 /var/www/vhosts/URL/modules/autoupgrade/classes/UpgradeTools/CoreUpgrader/CoreUpgrader80.php(39): PrestaShop\Module\AutoUpgrade\UpgradeTools\SymfonyAdapter->initKernel()
#18 /var/www/vhosts/URL/modules/autoupgrade/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php(110): PrestaShop\Module\AutoUpgrade\UpgradeTools\CoreUpgrader\CoreUpgrader80->initConstants()
#19 /var/www/vhosts/URL/modules/autoupgrade/classes/Task/Update/UpdateDatabase.php(142): PrestaShop\Module\AutoUpgrade\UpgradeTools\CoreUpgrader\CoreUpgrader->setupUpdateEnvironment()
#20 /var/www/vhosts/URL/modules/autoupgrade/classes/Task/Update/UpdateDatabase.php(49): PrestaShop\Module\AutoUpgrade\Task\Update\UpdateDatabase->warmUp()
#21 /var/www/vhosts/URL/modules/autoupgrade/classes/Task/Runner/ChainedTasks.php(66): PrestaShop\Module\AutoUpgrade\Task\Update\UpdateDatabase->run()
#22 /var/www/vhosts/URL/**admin_folder**/autoupgrade/ajax-upgradetab.php(54): PrestaShop\Module\AutoUpgrade\Task\Runner\ChainedTasks->run()
#23 {main}

 

Link to comment
Share on other sites

Glad that removing ps_edition_basic and clearing cache solved the Dotenv($envKey) error — thanks for circling back with detail.

Your new error:

ServiceNotFoundException: The service "prestashop.adapter.order.command_handler.add_product_to_order_handler" has a dependency on a non-existent service "Symfony\Component\Translation\TranslatorInterface".
Did you mean: "Symfony\Contracts\Translation\TranslatorInterface" or "PrestaShopBundle\Translation\TranslatorInterface"?
 

this means something in your shop (core config or, more often, a module/override) still references the old Symfony Symfony\Component\Translation\TranslatorInterface, which was replaced in newer Symfony/PrestaShop versions by the Contracts interface. PrestaShop 9 moved further toward Symfony 5.4+ conventions; translation services should use Symfony\Contracts\Translation\TranslatorInterface (or PS’s own translator alias), not the old Component interface. PrestaShop+2PrestaShop+2

Your new error comes from a module or override still using the old
Symfony\Component\Translation\TranslatorInterface.

  • Clear var/cache/* and rerun upgrade
  • Make sure autoupgrade is up to date
  • Search for that old interface in your modules/overrides and replace with

Symfony\Contracts\Translation\TranslatorInterface (or the translator service)

If unsure, disable modules one by one until the error disappears

That should get you past the missing service error.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...