Changeset 52799
- Timestamp:
- 02/25/2022 01:46:23 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/pluggable.php
r52422 r52799 379 379 if ( ! isset( $from_email ) ) { 380 380 // Get the site domain and get rid of www. 381 $sitename = wp_parse_url( network_home_url(), PHP_URL_HOST ); 382 if ( 'www.' === substr( $sitename, 0, 4 ) ) { 383 $sitename = substr( $sitename, 4 ); 381 $sitename = wp_parse_url( network_home_url(), PHP_URL_HOST ); 382 $from_email = 'wordpress@'; 383 384 if ( null !== $sitename ) { 385 if ( 'www.' === substr( $sitename, 0, 4 ) ) { 386 $sitename = substr( $sitename, 4 ); 387 } 388 389 $from_email .= $sitename; 384 390 } 385 386 $from_email = 'wordpress@' . $sitename;387 391 } 388 392 -
trunk/tests/phpunit/tests/mail.php
r52010 r52799 227 227 228 228 /** 229 * Tests that wp_mail() returns false with an empty home URL and does not error out on PHP 8.1. 230 * 231 * @ticket 54730 232 */ 233 public function test_wp_mail_with_empty_home_url() { 234 $to = 'address@tld.com'; 235 $subject = 'Testing'; 236 $message = 'Test Message'; 237 238 // Multisite test runs. 239 add_filter( 'network_home_url', '__return_empty_string' ); 240 241 // Single site test runs. 242 add_filter( 'home_url', '__return_empty_string' ); 243 244 $success = wp_mail( $to, $subject, $message ); 245 246 $this->assertFalse( $success, 'wp_mail() should have returned false' ); 247 $this->assertGreaterThan( 0, did_action( 'wp_mail_failed' ), 'wp_mail_failed action was not called' ); 248 } 249 250 /** 229 251 * @ticket 30266 230 252 */
Note: See TracChangeset
for help on using the changeset viewer.