Feeds: Avoid fatal error with empty blog_charset value.

After the SimplePie library was updated to version `1.8.0` in [59141], an edge case has been discovered where a fatal error can encountered if the `blog_charset` option is missing or empty.

In `fetch_feed()`, this option is retrieved using `get_option()` instead of `get_bloginfo( ‘charset’ )`. The latter will detect this scenario and apply a default value of `UTF-8` and is already used interchangeably throughout Core. This switches to `get_bloginfo( ‘charset’ )` instead to prevent this edge case.

Props david.binda, davidbaumwald, SergeyBiryukov, sabernhardt, azaozz, peterwilsoncc.
Fixes #62354.
Built from https://develop.svn.wordpress.org/trunk@59382


git-svn-id: http://core.svn.wordpress.org/trunk@58768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2024-11-11 17:50:17 +00:00
parent 818baef807
commit 883e20e3dd
2 changed files with 2 additions and 2 deletions

View File

@ -842,7 +842,7 @@ function fetch_feed( $url ) {
do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) ); do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );
$feed->init(); $feed->init();
$feed->set_output_encoding( get_option( 'blog_charset' ) ); $feed->set_output_encoding( get_bloginfo( 'charset' ) );
if ( $feed->error() ) { if ( $feed->error() ) {
return new WP_Error( 'simplepie-error', $feed->error() ); return new WP_Error( 'simplepie-error', $feed->error() );

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.8-alpha-59380'; $wp_version = '6.8-alpha-59382';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.