Reputation: 110
PHP Version: 8.1
Shopware Version: 6.4.13
Expected behaviour: Data migrated successfully and visible in the backend/frontend.
Actual behaviour: Migrated data doesn't appear to visible in backend/frontend and there are errors within the logs.
How to reproduce: I am trying to migrate from shopware 5.7 with demo-data to shopware 6.4 in my local development environment within a virtual environment. I had followed all instructions mentioned in the site https://docs.shopware.com/en/migration-en/Migrationprocess?category=migration-en/shopware5 I had used local gateway setup for this.
Although the status of migration is 'success'. No migrated data is visible in backend of shopware 6.4 and there are errors within the logs in migration process. I have attached a log for reference.
Error Log:
[error] SWAG_MIGRATION_RUN_EXCEPTION
An exception occurred
Entity: language, sourceId: -
SwagMigrationAssistant\Migration\Logging\Log\ExceptionRunLog::__construct(): Argument #4 ($sourceId) must be of type ?string, int given, called in /var/www/webdev/shopware56/custom/plugins/SwagMigrationAssistant/Migration/Service/MigrationDataConverter.php on line 144
[error] SWAG_MIGRATION_RUN_EXCEPTION
An exception occurred
Entity: category, sourceId: -
SwagMigrationAssistant\Profile\Shopware\Converter\ShopwareConverter::getSourceIdentifier(): Return value must be of type string, int returned
[error] SWAG_MIGRATION_RUN_EXCEPTION
An exception occurred
Entity: customer_group, sourceId: -
SwagMigrationAssistant\Profile\Shopware\Converter\ShopwareConverter::getSourceIdentifier(): Return value must be of type string, int returned
[error] SWAG_MIGRATION_RUN_EXCEPTION
An exception occurred
Entity: sales_channel, sourceId: -
SwagMigrationAssistant\Profile\Shopware\Converter\ShopwareConverter::getSourceIdentifier(): Return value must be of type string, int returned
Upvotes: 3
Views: 863
Reputation: 927
The cause of your problem is the use of PHP 8.1 on the Shopware 5 system.
Since PHP 8.1, the data for a SELECT is no longer returned as PHP strings by default, but now has correct data types such as integer or float. See https://www.php.net/manual/de/migration81.incompatible.php#migration81.incompatible.pdo
As a workaround, you could downgrade to PHP 8.0 or add the following to your config.php
in Shopware 5:
...
'db' => [
'username' => '<your-credentials>',
'password' => '<your-credentials>',
'dbname' => '<your-db-name>',
'host' => '<your-host>',
'driverOptions' => [
\PDO::ATTR_STRINGIFY_FETCHES => true,
],
],
...
With Shopware 5.7.15 this will be the default setting.
If the direct local database connection is used, you can try to add the driverOptions
parameter here:
https://github.com/shopware/SwagMigrationAssistant/blob/4.2.5/Profile/Shopware/Gateway/Connection/ConnectionFactory.php#L55-L62
Upvotes: 5