Skip to content

Commit

Permalink
Filter null bytes from trace due to anon class. This leads to a crash…
Browse files Browse the repository at this point in the history
… when using jsonb.
  • Loading branch information
DanielBadura committed Jan 6, 2025
1 parent dd53bd1 commit fac8d7c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Subscription/ThrowableToErrorContextTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ private static function transformThrowable(Throwable $error): array
*/
private static function transformTrace(array $trace): array
{
if (array_key_exists('class', $trace) && is_string($trace['class'])) {

Check failure on line 59 in src/Subscription/ThrowableToErrorContextTransformer.php

View workflow job for this annotation

GitHub Actions / Static Analysis by Psalm (locked, 8.3, ubuntu-latest)

RedundantConditionGivenDocblockType

src/Subscription/ThrowableToErrorContextTransformer.php:59:13: RedundantConditionGivenDocblockType: Docblock-defined type string for $trace['class'] is always string (see https://psalm.dev/156)

Check failure on line 59 in src/Subscription/ThrowableToErrorContextTransformer.php

View workflow job for this annotation

GitHub Actions / Static Analysis by Psalm (locked, 8.3, ubuntu-latest)

RedundantConditionGivenDocblockType

src/Subscription/ThrowableToErrorContextTransformer.php:59:50: RedundantConditionGivenDocblockType: Docblock-defined type string for $trace['class'] is always string (see https://psalm.dev/156)

Check failure on line 59 in src/Subscription/ThrowableToErrorContextTransformer.php

View workflow job for this annotation

GitHub Actions / Static Analysis by PHPStan (locked, 8.3, ubuntu-latest)

Call to function is_string() with string will always evaluate to true.
$trace['class'] = str_replace("\x00", '', $trace['class']);
}

if (!array_key_exists('args', $trace)) {
return $trace;
}
Expand Down

0 comments on commit fac8d7c

Please sign in to comment.