Fix quoted-word-dot local parts, eliminate ParserConfusion leak, C1 in comments - #66
Merged
Conversation
…n comments
Resolves the three pre-existing bugs found during review.
- Quoted-string as a non-first local-part word ("x"."y"@, x."y"@, "a b"."c"@)
is now accepted — a valid obs-local-part (RFC 5322 §3.4.1: word *("." word)).
The final quoted word is flushed onto the accumulated local part exactly as the
dot handler flushes earlier words. Abutment without a dot ("x""y"@) still fails.
Removes the first ParserConfusion site.
- ParserConfusion no longer reaches callers. The remaining path — a domain literal
after domain characters (user@a[1.2.3.4]) — is rejected up front as
InvalidOpeningBracket: a domain literal is the entire domain, not appended to a
dot-atom. 500k-input fuzz confirms ParserConfusion is unreachable.
- C1 controls (U+0080–U+009F) in comment content are rejected when rejectC1Controls
is set (rfc6531), matching local-part and quoted-string handling.
103 -> 106 tests; PHPStan level 8 / Psalm / cs clean.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #66 +/- ##
============================================
- Coverage 95.92% 95.59% -0.34%
- Complexity 423 428 +5
============================================
Files 6 6
Lines 1056 1066 +10
============================================
+ Hits 1013 1019 +6
- Misses 43 47 +4
🚀 New features to boost your workflow:
|
The canonical-round-trip property test failed non-deterministically (time-seed; surfaced on the 8.5 job) on inputs producing an empty quoted local part. Two real, pre-existing bugs: - canonical() rendered an empty local part as bare '' -> "@Domain", which is invalid. It now renders "" (an empty local part is only valid quoted). - <""@host> (empty quoted local part in an angle-addr) was mistaken for the "no local part" that starts an obs-route, so it failed to re-parse. The obs-route trigger now excludes a quoted local part. Both verified across ~55 property-test seeds. Explicit regression test added. 106 -> 107 tests; PHPStan / Psalm / cs clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves the three pre-existing bugs found during the review of #65 (all present on master, none in the isemail corpus).
Fixed
"x"."y"@,x."y"@,"a b"."c"@are now accepted. These are validobs-local-part(RFC 5322 §3.4.1:word *("." word),word = atom / quoted-string) but previously surfaced the internalParserConfusioncode. The@handler now flushes the final quoted word onto the accumulated local part exactly as the dot handler flushes earlier words. Abutment without a separating dot ("x""y"@) is still rejected.ParserConfusionno longer reaches callers. The remaining path — a domain literal after domain characters (user@a[1.2.3.4]) — is now rejected up front asInvalidOpeningBracket: a domain literal is the entire domain, not appended to a dot-atom. A 500k-input fuzz confirmsParserConfusionis now unreachable.rejectC1Controlsis set (rfc6531), matching the existing local-part and quoted-string handling.Verification
103 → 106 tests (+ the seeded property tests still hold across seeds); PHPStan level 8 / Psalm / cs clean. No API changes — pure parser correctness.
This clears the ROADMAP "pre-existing bugs" list.