Make WordPress Core

Changeset 59241


Ignore:
Timestamp:
10/15/2024 10:22:42 PM (2 months ago)
Author:
peterwilsoncc
Message:

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.

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/feed.php

    r59141 r59241  
    482482            foreach ( (array) $val as $enc ) {
    483483                $enclosure = explode( "\n", $enc );
     484
     485                if ( count( $enclosure ) < 3 ) {
     486                    continue;
     487                }
    484488
    485489                // Only get the first element, e.g. 'audio/mpeg' from 'audio/mpeg mpga mp2 mp3'.
Note: See TracChangeset for help on using the changeset viewer.