Fix SOA RNAME email local-part encoding#46
Conversation
Greptile SummaryThis PR fixes SOA RNAME encoding for email-form inputs (e.g.
Confidence Score: 5/5The encoding logic is correct for all common email-form RNAME inputs and backward-compatible with existing DNS-notation RNAME values; the change is safe to merge. The new The two new Important Files Changed
Reviews (3): Last reviewed commit: "Narrow SOA RNAME email encoding fix" | Re-trigger Greptile |
- Make Domain::encode preprocessing escape-aware (no more rtrim corrupting
escaped dots, no more str_ends_with('..') false-positives).
- Reject dangling trailing backslashes and unknown \X escape sequences in
splitLabels so silent behavior changes surface loudly.
- Validate SOA RNAME up-front: exactly one @, non-empty local part and
domain, no trailing backslash in the local part.
- Document encode/decode asymmetry on Domain::decode.
- Add regression tests covering escaped-dot edge cases, dangling and
unknown escapes, SOA wire round-trip, multi-@, empty local part / domain,
pre-escaped RNAME, single-label RNAME, and over-long local part.
Summary
hostmaster@example.com.first.last@example.com.Domain::encode()behavior unchanged so the PR only touches the SOA production regression path.Testing
./vendor/bin/phpunit --configuration phpunit.xml --filter 'RecordTest|FileTest'php -d memory_limit=512M ./vendor/bin/phpstan analyse --level max -c phpstan.neon src tests./vendor/bin/pint --test --config pint.jsonNote: Pint passed, but PHP 8.5 emitted deprecation noise from Pint/Laravel Zero dependencies.