Skip to content

Commit 65c0004

Browse files
Pings/Trackbacks: Validate that the specified charset is available on the receiving site.
This aims to avoid a subsequent fatal error from `mb_convert_encoding()` when an invalid charset is specified. Follow-up to [1734], [2563], [12032]. Props dd32, jrf, oglekler, rajinsharwar. Fixes #60261. git-svn-id: https://develop.svn.wordpress.org/trunk@59255 602fd350-edb4-49c9-b593-d223f7449a82
1 parent c234538 commit 65c0004

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/wp-trackback.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,14 @@ function trackback_response( $error = 0, $error_message = '' ) {
6060

6161
if ( $charset ) {
6262
$charset = str_replace( array( ',', ' ' ), '', strtoupper( trim( $charset ) ) );
63-
} else {
63+
64+
// Validate the specified "sender" charset is available on the receiving site.
65+
if ( function_exists( 'mb_list_encodings' ) && ! in_array( $charset, mb_list_encodings(), true ) ) {
66+
$charset = '';
67+
}
68+
}
69+
70+
if ( ! $charset ) {
6471
$charset = 'ASCII, UTF-8, ISO-8859-1, JIS, EUC-JP, SJIS';
6572
}
6673

0 commit comments

Comments
 (0)