Make WordPress Core


Ignore:
Timestamp:
10/18/2024 03:54:07 PM (7 weeks ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-trackback.php

    r55988 r59255  
    6161if ( $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
     70if ( ! $charset ) {
    6471    $charset = 'ASCII, UTF-8, ISO-8859-1, JIS, EUC-JP, SJIS';
    6572}
Note: See TracChangeset for help on using the changeset viewer.