Doctrine ConversionException during message execution

Viewed 62

During message execution we get always the following error:

Doctrine\DBAL\Types\ConversionException^ {
  message: "Could not convert database value to 'array' as an error was triggered by the unserialization: 'unserialize(): Error at offset 245 of 5267 bytes'"
  code: 0
  file: "/app/vendor/doctrine/dbal/src/Types/ConversionException.php"
  line: 117
  trace: {
    ./vendor/doctrine/dbal/src/Types/ConversionException.php:117 { …}
    ./vendor/doctrine/dbal/src/Types/ArrayType.php:48 { …}
    Doctrine\DBAL\Types\ArrayType->Doctrine\DBAL\Types\{closure}() {
      namespace: "Doctrine\DBAL\Types"
      short_class: "ArrayType"
    }
    ./vendor/doctrine/dbal/src/Types/ArrayType.php:52 { …}
    ./vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php:140 { …}
    ./vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php:63 { …}
    ./vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php:270 { …}
    ./vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:919 { …}
    ./vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php:227 { …}
    ./src/MessageHandler/StartMigrationSignalHandler.php:97 {
      App\MessageHandler\StartMigrationSignalHandler->__invoke(StartMigrationSignal $signal)^
      › $users = $this->em->getRepository(User::class)->findBy(
      ›     ['enabled' => true], ['username' => 'ASC'], $perPage, $offset
      › );
      arguments: {
        $criteria: [ …2]
        $orderBy: [ …2]
        $limit: [ …2]
        $offset: [ …2]
      }
    }
    ./vendor/symfony/messenger/Middleware/HandleMessageMiddleware.php:96 { …}
    ./vendor/symfony/messenger/Middleware/SendMessageMiddleware.php:74 { …}
    ./vendor/symfony/messenger/Middleware/FailedMessageProcessingMiddleware.php:34 { …}
    ./vendor/symfony/messenger/Middleware/DispatchAfterCurrentBusMiddleware.php:68 { …}
    ./vendor/symfony/messenger/Middleware/RejectRedeliveredMessageMiddleware.php:48 { …}
    ./vendor/symfony/messenger/Middleware/AddBusNameStampMiddleware.php:37 { …}
    ./vendor/symfony/messenger/Middleware/TraceableMiddleware.php:43 { …}
    ./vendor/symfony/messenger/MessageBus.php:77 { …}
    ./vendor/symfony/messenger/TraceableMessageBus.php:41 { …}
    ./vendor/symfony/messenger/RoutableMessageBus.php:54 { …}
    ./vendor/symfony/messenger/Worker.php:160 { …}
    ./vendor/symfony/messenger/Worker.php:108 { …}
    ./vendor/symfony/messenger/Command/ConsumeMessagesCommand.php:225 { …}
    ./vendor/symfony/console/Command/Command.php:298 { …}
    ./vendor/symfony/console/Application.php:1042 { …}
    ./vendor/symfony/framework-bundle/Console/Application.php:96 { …}
    ./vendor/symfony/console/Application.php:299 { …}
    ./vendor/symfony/framework-bundle/Console/Application.php:82 { …}
    ./vendor/symfony/console/Application.php:171 { …}
    ./bin/console:42 { …}
  }
}

After some time of debugging, we could limit the failing entry to this query:

SELECT * FROM `security_user` WHERE `enabled` = '1' ORDER BY `username` LIMIT 1 OFFSET 7209

I looked at the entry, but it appears to be flawless. Also if I call manually the unserialize function on the serialized database fields I can decode them without problem. Funny enough I can view the entity just fine in our SonataAdmin interface.

The fields in question would be of type array, but as only one entry fails I guess it is not caused by some issue in the class:

class User extends BaseUser
{
    // ...

    /**
     * @var array
     * @ORM\Column(type="array")
     */
    protected $userData = [];


    /**
     * @var array
     * @ORM\Column(type="array")
     */
    protected $ssoRoles = [];


    /**
     * @var string[]
     * @ORM\Column(type="array")
     */
    protected $roles;


}

Anybody knows what could be the cause or how to debug this?

0 Answers
Related