SIGN IN SIGN UP
laravel / framework UNCLAIMED

Laravel is a web application framework with expressive, elegant syntax.

0 0 135 PHP

Accept Symfony's new control-characters exception message in mailer test (#60202)

`symfony/mime` 7.4.12 added an early control-character guard in `Address::__construct` that throws `InvalidArgumentException('Email address contains control characters.')` before the older `RfcComplianceException('Email addresses may not contain line break characters.')` ever fires.

`testMailerRejectsSymfonyAddressesContainingLineBreaks` constructs `new Address("\"foo\r\nBcc: ...\"@example.com")` to trigger the rejection, so it now hits the new message instead of the old one. The composer constraint is `^7.4.0`, so both messages are reachable depending on which patch version a user has installed.

Switch the test to a try/catch+assertContains pattern so it accepts either Symfony exception message as a valid outcome. The exception class (InvalidArgumentException) and the throw-required guarantee (via `$this->fail()`) are still pinned. This pattern is already used elsewhere in the test suite (e.g. tests/Cache/CacheRepositoryTest.php, tests/Auth/AuthHandlesAuthorizationTest.php).
K
Kieran Brown committed
77de82bc31006f9e3b4344b3d0a54b9d7b446e49
Parent: 54e3bc2
Committed by GitHub <noreply@github.com> on 5/20/2026, 12:15:36 PM