Commit d30cc780fd for wordpress.org

commit d30cc780fde9f76bd2ededf9a28284fddd772ef6
Author: Peter Wilson <wilson@peterwilson.cc>
Date:   Tue Oct 15 22:24:18 2024 +0000

    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

diff --git a/wp-includes/feed.php b/wp-includes/feed.php
index 7ef7059ce4..810abfee6f 100644
--- a/wp-includes/feed.php
+++ b/wp-includes/feed.php
@@ -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];
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 0498e78083..c8db80d52b 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -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.