Commit 4700a28494 for wordpress.org
commit 4700a28494a7861ffd0122e66a13f3b62a3792d6
Author: SergeyBiryukov <sergeybiryukov@git.wordpress.org>
Date: Thu Sep 24 08:45:51 2026 +0000
General: Avoid repeated `get_option()` calls in `wp-mail.php`.
The `get_option( 'blog_charset' )` value is constant for the duration of the call. Resolving it once before the loop avoids the overhead of extra function calls and filter applications.
Follow-up to r10011.
Props arshidkv12.
Fixes #66154.
Built from https://develop.svn.wordpress.org/trunk@63914
git-svn-id: http://core.svn.wordpress.org/trunk@63083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 8dedab56e4..1c3e6e6cc2 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-alpha-63913';
+$wp_version = '7.2-alpha-63914';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
diff --git a/wp-mail.php b/wp-mail.php
index 3f39de4264..ffa51b7fd2 100644
--- a/wp-mail.php
+++ b/wp-mail.php
@@ -76,6 +76,8 @@ if ( 0 === $count ) {
// Always run as an unauthenticated user.
wp_set_current_user( 0 );
+$blog_charset = get_option( 'blog_charset' );
+
for ( $i = 1; $i <= $count; $i++ ) {
$message = $pop3->get( $i );
@@ -125,7 +127,7 @@ for ( $i = 1; $i <= $count; $i++ ) {
$subject = substr( $subject, 9, strlen( $subject ) - 9 );
// Captures any text in the subject before $phone_delim as the subject.
if ( function_exists( 'iconv_mime_decode' ) ) {
- $subject = iconv_mime_decode( $subject, 2, get_option( 'blog_charset' ) );
+ $subject = iconv_mime_decode( $subject, 2, $blog_charset );
} else {
$subject = wp_iso_descrambler( $subject );
}
@@ -205,7 +207,7 @@ for ( $i = 1; $i <= $count; $i++ ) {
}
if ( function_exists( 'iconv' ) && ! empty( $charset ) ) {
- $content = iconv( $charset, get_option( 'blog_charset' ), $content );
+ $content = iconv( $charset, $blog_charset, $content );
}
// Captures any text in the body after $phone_delim as the body.