Jump to content

HTTP 500 Internal Server Error - preg_match(): Argument #2 ($subject) must be of type string, array given


Recommended Posts

Hello together!

i have a problem to update modules, clear cache backend and per ftp, cannot upgrade prestashop from 8.1.5 to 9.0.0 for example. on debug mode it shows me this errors. to login in backend i only can bring back the backup. but the error still there in only the cache files shows the backend and frontend. does anybody have an idea to solve it?

HTTP 500 Internal Server Error - preg_match(): Argument #2 ($subject) must be of type string, array given   

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Alias.php (line 102)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Alias.php preg_match (line 102)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php -> setDeprecated (line 361)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php -> parseDefinition (line 234)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php -> parseDefinitions (line 154)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/FileLoader.php -> load (line 165)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/FileLoader.php -> doImport (line 93)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php -> import (line 66)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php -> import (line 197)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php -> parseImports (line 133)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/FileLoader.php -> load (line 165)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/FileLoader.php -> doImport (line 93)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php -> import (line 66)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php -> import (line 197)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php -> parseImports (line 133)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/FileLoader.php -> load (line 165)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/FileLoader.php -> doImport (line 104)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php -> import (line 66)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php -> import (line 197)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php -> parseImports (line 133)

YamlFileLoader->load('services_dev.yml')in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/src/PrestaShopBundle/DependencyInjection/PrestaShopExtension.php (line 49)

        $configuration = new AddOnsConfiguration();

        $config = $this->processConfiguration($configuration, $configs);

        $loader = new YamlFileLoader($container, new FileLocator(dirname(__DIR__) . '/Resources/config'));

        $env = $container->getParameter('kernel.environment');

        $loader->load('services_' . $env . '.yml');

        $container->setParameter('prestashop.addons.categories', $config['addons']['categories']);

    }

    /**

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php -> load (line 76)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php -> process (line 39)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php -> process (line 94)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php -> compile (line 762)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php -> compile (line 594)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php -> initializeContainer (line 136)

Kernel->boot()in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/app/AppKernel.php (line 96)

in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php -> boot (line 196)

Kernel->handle(object(Request), 1, false)in /var/www/vhosts/hosting118602.a2f87.netcup.net/bitex-fanshop.de/httpdocs/admin2018/index.php (line 84)

Link to comment
Share on other sites

  • 2 weeks later...

That error usually appears when upgrading from PrestaShop 8.1.x to 9.0.0 due to incompatible YAML configuration or Symfony service definitions where preg_match() expects a string but receives an array (commonly in /config/services_dev.yml or a custom module config file).

Here’s how you can fix it step by step:

Clear all cache manually via FTP

Delete these folders completely:

/var/cache/dev /var/cache/prod

Do not just empty them from the Back Office — do it via FTP or SSH.

Check for duplicated or custom YML definitions

Look inside /src/PrestaShopBundle/Resources/config/ for services_dev.yml.

If you have any module overriding core services (especially with alias: or deprecated: keys), comment them temporarily.

The error preg_match(): Argument #2 must be of type string often comes from an invalid “alias” entry like this:

some.alias: alias: [invalid_array_instead_of_string]

Replace it with:

some.alias: alias: 'valid_service_name'

Regenerate the autoload and cache
Run the following commands in your PrestaShop root (SSH recommended):

php bin/console cache:clear --no-warmup composer dump-autoload php bin/console cache:warmup

If you still get 500 error after upgrade

Reinstall vendor dependencies:

rm -rf vendor composer install --no-dev

Ensure your PHP version is 8.1 or 8.2 (PrestaShop 9 is not yet stable under 8.3 in some cases).

We faced this same issue during upgrades for some client stores — fixing the YAML alias and clearing cache manually usually resolves it.

If you still get errors, you can restore your services_dev.yml from a clean PrestaShop 8.1.5 package and test again.

Link to comment
Share on other sites

8 minutes ago, bitex said:

its that a chat gpt or a real solution? doesnt work.

chatgpt can give real solutions if it has all the information..it's all about prompts  so please know if someone uses chatgpt or other AI, they are still taking their time in helping.  Also replying doesn't work is not helpful, how did it not work and did you find any

 

you should not, nor should anyone else really be upgrading to 9.0.0, this is a beta version and has some base issues that will be fixed  in 9.0.1.

Wait for 9.0.1.

Link to comment
Share on other sites

i solved the problem to get 8.1.5 run back without the error again.
but wait now for new version 9.0.1 till i try again upgrade.

- i started to put the fresh prestashop 8.1.5 in a new folder. and backup the old folder safely. https://github.com/PrestaShop/PrestaShop/releases/download/8.1.5/prestashop_8.1.5.zip
- delete the install folder.
- copy my old database connection file /httpdocs/app/config/parameters.php into the new folder.
- copy my old .htaccess into the new root folder.
- copy my old custom "img" folder for productimages into the new folder.
- copy my old custom "mails" folder for mailtemplates into the new folder.
- copy my custom "modules" into the new folder. to figure out i compare the prestashop original modules with my old installed modules.
- copy my custom "themes" (classic) into the new folder.
- copy my custom "override" into the new folder.

after all the site works in debugmodus without error and all old data, permalinks, images, mails, modules, themes & override work again!

Edited by bitex (see edit history)
  • Like 1
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...