Skip to content

Conversation

@mmucklo
Copy link
Owner

@mmucklo mmucklo commented Feb 7, 2026

No description provided.

- Fix local part max length to 64 octets (was incorrectly 63)
- Use strlen instead of mb_strlen to count octets not characters
- Update error messages to reference RFC 5321 and RFC erratum 1690
- Test local part at exactly 64 octets (valid)
- Test local part at 65 octets (invalid - exceeds RFC 5321 limit)
- Test total email length exceeding 254 octets (invalid)
- Test domain label exceeding 63 characters (invalid)
- All 96 tests passing (92 original + 4 new length tests)
- Add maxLocalPartLength, maxTotalLength, maxDomainLabelLength to ParseOptions
- Allow overriding RFC 5321 default limits (64, 254, 63)
- Update Parse.php to use configurable limits instead of hardcoded values
- Add getter/setter methods for all length limits
- Add 4 comprehensive tests for custom length limits
- All 100 tests passing (96 + 4 new custom length tests)
- Create new LengthLimits class to group length constraints
- Provides cleaner API with grouped options
- Add static factory methods: createDefault() and createRelaxed()
- Update ParseOptions to accept LengthLimits object
- Keep backward compatibility with individual getter/setter methods
- All 100 tests passing

Usage:
  // Using LengthLimits object
  $limits = new LengthLimits(100, 300, 100);
  $options = new ParseOptions([], [','], true, $limits);

  // Using factory
  $options = new ParseOptions([], [','], true, LengthLimits::createRelaxed());
@codecov-commenter
Copy link

codecov-commenter commented Feb 7, 2026

Codecov Report

❌ Patch coverage is 62.79070% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.55%. Comparing base (13d5c7e) to head (ff845e5).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/ParseOptions.php 44.44% 10 Missing ⚠️
src/LengthLimits.php 70.00% 6 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master      #45      +/-   ##
============================================
- Coverage     75.98%   75.55%   -0.43%     
- Complexity      200      217      +17     
============================================
  Files             2        3       +1     
  Lines           458      495      +37     
============================================
+ Hits            348      374      +26     
- Misses          110      121      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Add test for custom maxTotalLength validation
- Add test for LengthLimits::createRelaxed() factory method
- Covers previously untested code paths
- All 102 tests passing (100 original + 2 new coverage tests)
- Ensures test coverage increases with new features
@mmucklo mmucklo merged commit b2bdb82 into master Feb 7, 2026
8 checks passed
@mmucklo mmucklo deleted the feature/length branch February 7, 2026 22:36
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