Skip to content

Represent null bytes visibly in Sentry log messages - #750

Merged
g105b merged 2 commits into
masterfrom
fix/sentry-log-null-bytes
Nov 12, 2026
Merged

g105b merged 2 commits into
masterfrom
fix/sentry-log-null-bytes

Conversation

@g105b

@g105b g105b commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

PHP includes a null byte in anonymous class names. When an exception message containing that name is sent through SentryLogHandler, GlitchTip's PostgreSQL log storage rejects it and the entire log batch fails.

Replace null bytes with ␀ (U+2400, Symbol for Null), preserving a visible marker in the exception details. Apply the existing 8 KiB message limit with UTF-8-safe truncation so a multibyte symbol cannot be split into invalid text.

Validation: all 279 PHPUnit tests (1,074 assertions) pass, including anonymous exceptions, multiple null bytes, unchanged ordinary messages and literal escapes, existing symbols, and truncation at a symbol boundary. PHPCS, PHPMD, and PHPStan also pass.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@g105b g105b changed the title Escape null bytes in Sentry log messages Represent null bytes visibly in Sentry log messages Nov 11, 2026
@g105b
g105b merged commit c737ed0 into master Nov 12, 2026
29 checks passed
@g105b
g105b deleted the fix/sentry-log-null-bytes branch November 12, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant