Skip to content

Robustesse : appliquer la limite de taille après normalisation Unicode, nettoyer .gitignore - #53

Open
jmcollin wants to merge 2 commits into
mainfrom
fix/size-limit-after-normalization
Open

jmcollin wants to merge 2 commits into
mainfrom
fix/size-limit-after-normalization

Conversation

@jmcollin

@jmcollin jmcollin commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Empilée sur #50, le correctif urgent de main. Merger #50 d'abord.

Problèmes (points 15 et 16 de la review)

15. Limite maxBytes contournable. La taille était vérifiée avant la normalisation NFC. Or NFC peut agrandir l'entrée : U+0958 n'a pas de forme composée et double de taille (3 → 6 octets). Le parser pouvait donc traiter jusqu'à environ 2× maxBytes.

16. .gitignore listait /phpunit.xml, qui est pourtant la configuration PHPUnit versionnée. Une règle d'ignore n'a aucun effet sur un fichier suivi par git, elle ne fait qu'induire en erreur.

Correctif

  • MarkdownParser::guard() revérifie la taille sur la chaîne normalisée, avec un message explicite (« after Unicode normalization »).
  • Suppression des entrées /phpunit.xml et /app/phpunit.xml de .gitignore.

Tests

  • Nouveau test testMaxBytesIsEnforcedAfterNormalization : 30 octets avant NFC, 60 après, limite à 40.
  • PHPUnit OK (918 tests), PHPStan et Psalm sans erreur.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CPcuaaxrCottkeL1ykoSWe


Generated by Claude Code

claude added 2 commits October 8, 2026 10:05
#44 (blockquote laziness) and #45 (table detection) were merged in that
order. #44 used PATTERN_TABLE_SEPARATOR in quoteLineState(), #45 deleted
the constant, so every blockquote now throws
"Error: Undefined constant Lexer::PATTERN_TABLE_SEPARATOR" on main
(40 test errors).

The check added nothing to blockquote laziness; drop it.

(cherry picked from commit 7e799b1, pushed to the #44 branch after #44
had already been merged)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPcuaaxrCottkeL1ykoSWe
…phpunit.xml

- The size limit was checked before Unicode normalization, but NFC can
  grow the input (U+0958 has no composed form and doubles in size), so
  the parser could process more than maxBytes. The limit is now also
  checked on the normalized string.
- .gitignore listed /phpunit.xml although it is the tracked PHPUnit
  config (an ignore rule has no effect on a tracked file and only
  misleads); the entries are removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPcuaaxrCottkeL1ykoSWe
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.

2 participants