From 22e924a19e927e3913da16f0fcdfdd957afa15c9 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Fri, 17 Jul 2026 13:40:32 +0100 Subject: [PATCH] Document diagnostic escaping fallback --- AGENTS.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 0cac93a..7d30cc1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -9,7 +9,9 @@ - Handle `preg_*` engine failures: when the result is used as data, test for `false` or `null` and throw a `\RuntimeException` including `preg_last_error_msg()`; boolean validation guards must compare strictly, such - as `=== 1`, so an engine failure can only ever fail closed. + as `=== 1`, so an engine failure can only ever fail closed. Diagnostic + escaping is the narrow exception: use a deterministic bytewise fallback rather + than throwing, so it cannot obscure the original exception. - Anchor validation patterns to the true end of input with the `D` modifier or `\z`; a bare `$` accepts a trailing newline. - Never embed raw control bytes in exception messages and other diagnostics;