Skip to content

Commit

Permalink
use more entropy with uniqid()
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Jul 15, 2024
1 parent ffe0eef commit 430a73d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Debug/TraceableSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(

public function serialize(mixed $data, string $format, array $context = []): string
{
$context[self::DEBUG_TRACE_ID] = $traceId = uniqid();
$context[self::DEBUG_TRACE_ID] = $traceId = uniqid('', true);

$startTime = microtime(true);
$result = $this->serializer->serialize($data, $format, $context);
Expand All @@ -56,7 +56,7 @@ public function serialize(mixed $data, string $format, array $context = []): str

public function deserialize(mixed $data, string $type, string $format, array $context = []): mixed
{
$context[self::DEBUG_TRACE_ID] = $traceId = uniqid();
$context[self::DEBUG_TRACE_ID] = $traceId = uniqid('', true);

$startTime = microtime(true);
$result = $this->serializer->deserialize($data, $type, $format, $context);
Expand All @@ -71,7 +71,7 @@ public function deserialize(mixed $data, string $type, string $format, array $co

public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
{
$context[self::DEBUG_TRACE_ID] = $traceId = uniqid();
$context[self::DEBUG_TRACE_ID] = $traceId = uniqid('', true);

$startTime = microtime(true);
$result = $this->serializer->normalize($object, $format, $context);
Expand All @@ -86,7 +86,7 @@ public function normalize(mixed $object, ?string $format = null, array $context

public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
$context[self::DEBUG_TRACE_ID] = $traceId = uniqid();
$context[self::DEBUG_TRACE_ID] = $traceId = uniqid('', true);

$startTime = microtime(true);
$result = $this->serializer->denormalize($data, $type, $format, $context);
Expand All @@ -101,7 +101,7 @@ public function denormalize(mixed $data, string $type, ?string $format = null, a

public function encode(mixed $data, string $format, array $context = []): string
{
$context[self::DEBUG_TRACE_ID] = $traceId = uniqid();
$context[self::DEBUG_TRACE_ID] = $traceId = uniqid('', true);

$startTime = microtime(true);
$result = $this->serializer->encode($data, $format, $context);
Expand All @@ -116,7 +116,7 @@ public function encode(mixed $data, string $format, array $context = []): string

public function decode(string $data, string $format, array $context = []): mixed
{
$context[self::DEBUG_TRACE_ID] = $traceId = uniqid();
$context[self::DEBUG_TRACE_ID] = $traceId = uniqid('', true);

$startTime = microtime(true);
$result = $this->serializer->decode($data, $format, $context);
Expand Down

0 comments on commit 430a73d

Please sign in to comment.