Feeds: Validate enclosures prior to generating tags.

Prevent possible PHP warnings caused by malformed enclosure meta data. This change ensures the enclosure meta data has at least three lines of text before generating the tag in `rss_enclosure()`.

Props arypneta, johnjamesjacoby, nihar007, rahmohn, rghedin, zahardoc.
Fixes #58798.


Built from https://develop.svn.wordpress.org/trunk@59241


git-svn-id: http://core.svn.wordpress.org/trunk@58633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2024-10-15 22:24:18 +00:00
parent 0d6d21f9a9
commit d30cc780fd
2 changed files with 5 additions and 1 deletions

View File

@ -482,6 +482,10 @@ function rss_enclosure() {
foreach ( (array) $val as $enc ) {
$enclosure = explode( "\n", $enc );
if ( count( $enclosure ) < 3 ) {
continue;
}
// Only get the first element, e.g. 'audio/mpeg' from 'audio/mpeg mpga mp2 mp3'.
$t = preg_split( '/[ \t]/', trim( $enclosure[2] ) );
$type = $t[0];

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.7-beta3-59240';
$wp_version = '6.7-beta3-59241';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.