diff --git a/src/Store/DoctrineDbalStore.php b/src/Store/DoctrineDbalStore.php index 76c775bd3..35ef41372 100644 --- a/src/Store/DoctrineDbalStore.php +++ b/src/Store/DoctrineDbalStore.php @@ -337,6 +337,7 @@ public function configureSchema(Schema $schema, Connection $connection): void ->setLength(255) ->setNotnull(true); $table->addColumn('payload', Types::JSON) + ->setPlatformOption('jsonb', true) ->setNotnull(true); $table->addColumn('recorded_on', Types::DATETIMETZ_IMMUTABLE) ->setNotnull(true); @@ -347,6 +348,7 @@ public function configureSchema(Schema $schema, Connection $connection): void ->setNotnull(true) ->setDefault(false); $table->addColumn('custom_headers', Types::JSON) + ->setPlatformOption('jsonb', true) ->setNotnull(true); $table->setPrimaryKey(['id']); diff --git a/src/Store/StreamDoctrineDbalStore.php b/src/Store/StreamDoctrineDbalStore.php index 69ef4b9ea..af15bfbc6 100644 --- a/src/Store/StreamDoctrineDbalStore.php +++ b/src/Store/StreamDoctrineDbalStore.php @@ -416,6 +416,7 @@ public function configureSchema(Schema $schema, Connection $connection): void ->setLength(255) ->setNotnull(true); $table->addColumn('event_payload', Types::JSON) + ->setPlatformOption('jsonb', true) ->setNotnull(true); $table->addColumn('recorded_on', Types::DATETIMETZ_IMMUTABLE) ->setNotnull(true); @@ -423,6 +424,7 @@ public function configureSchema(Schema $schema, Connection $connection): void ->setNotnull(true) ->setDefault(false); $table->addColumn('custom_headers', Types::JSON) + ->setPlatformOption('jsonb', true) ->setNotnull(true); $table->setPrimaryKey(['id']); diff --git a/src/Subscription/Store/DoctrineSubscriptionStore.php b/src/Subscription/Store/DoctrineSubscriptionStore.php index 08cde34df..e06fb7259 100644 --- a/src/Subscription/Store/DoctrineSubscriptionStore.php +++ b/src/Subscription/Store/DoctrineSubscriptionStore.php @@ -230,6 +230,7 @@ public function configureSchema(Schema $schema, Connection $connection): void ->setLength(32) ->setNotnull(false); $table->addColumn('error_context', Types::JSON) + ->setPlatformOption('jsonb', true) ->setNotnull(false); $table->addColumn('retry_attempt', Types::INTEGER) ->setNotnull(true); diff --git a/src/Subscription/ThrowableToErrorContextTransformer.php b/src/Subscription/ThrowableToErrorContextTransformer.php index 68d147ea4..975efa417 100644 --- a/src/Subscription/ThrowableToErrorContextTransformer.php +++ b/src/Subscription/ThrowableToErrorContextTransformer.php @@ -21,6 +21,7 @@ use function is_resource; use function mb_strlen; use function mb_substr; +use function str_replace; /** * @psalm-import-type Context from SubscriptionError @@ -70,6 +71,10 @@ private static function transformThrowable(Throwable $error): array */ private static function transformTrace(array $trace): array { + if (array_key_exists('class', $trace)) { + $trace['class'] = str_replace("\x00", '', $trace['class']); + } + if (!array_key_exists('args', $trace)) { return $trace; } diff --git a/tests/Unit/Store/DoctrineDbalStoreTest.php b/tests/Unit/Store/DoctrineDbalStoreTest.php index dd6af5edc..969c34edf 100644 --- a/tests/Unit/Store/DoctrineDbalStoreTest.php +++ b/tests/Unit/Store/DoctrineDbalStoreTest.php @@ -1310,6 +1310,7 @@ public function testConfigureSchema(): void ->setLength(255) ->setNotnull(true); $table->addColumn('payload', Types::JSON) + ->setPlatformOption('jsonb', true) ->setNotnull(true); $table->addColumn('recorded_on', Types::DATETIMETZ_IMMUTABLE) ->setNotnull(true); @@ -1320,6 +1321,7 @@ public function testConfigureSchema(): void ->setNotnull(true) ->setDefault(false); $table->addColumn('custom_headers', Types::JSON) + ->setPlatformOption('jsonb', true) ->setNotnull(true); $table->setPrimaryKey(['id']); @@ -1362,6 +1364,7 @@ public function testConfigureSchemaWithStringAsAggregateIdType(): void ->setLength(255) ->setNotnull(true); $table->addColumn('payload', Types::JSON) + ->setPlatformOption('jsonb', true) ->setNotnull(true); $table->addColumn('recorded_on', Types::DATETIMETZ_IMMUTABLE) ->setNotnull(true); @@ -1372,6 +1375,7 @@ public function testConfigureSchemaWithStringAsAggregateIdType(): void ->setNotnull(true) ->setDefault(false); $table->addColumn('custom_headers', Types::JSON) + ->setPlatformOption('jsonb', true) ->setNotnull(true); $table->setPrimaryKey(['id']); diff --git a/tests/Unit/Store/StreamDoctrineDbalStoreTest.php b/tests/Unit/Store/StreamDoctrineDbalStoreTest.php index d90085a22..f581a0e9e 100644 --- a/tests/Unit/Store/StreamDoctrineDbalStoreTest.php +++ b/tests/Unit/Store/StreamDoctrineDbalStoreTest.php @@ -1416,6 +1416,7 @@ public function testConfigureSchema(): void ->setLength(255) ->setNotnull(true); $table->addColumn('event_payload', Types::JSON) + ->setPlatformOption('jsonb', true) ->setNotnull(true); $table->addColumn('recorded_on', Types::DATETIMETZ_IMMUTABLE) ->setNotnull(true); @@ -1423,6 +1424,7 @@ public function testConfigureSchema(): void ->setNotnull(true) ->setDefault(false); $table->addColumn('custom_headers', Types::JSON) + ->setPlatformOption('jsonb', true) ->setNotnull(true); $table->setPrimaryKey(['id']);