Make WordPress Core


Ignore:
Timestamp:
04/16/2010 07:48:30 PM (15 years ago)
Author:
nacin
Message:

Some sanity checks for parse_url in do_enclose. props miqrogroove, fixes #11029

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r14108 r14116  
    11981198    foreach ( (array) $post_links_temp[0] as $link_test ) {
    11991199        if ( !in_array( $link_test, $pung ) ) { // If we haven't pung it already
    1200             $test = parse_url( $link_test );
     1200            $test = @parse_url( $link_test );
     1201            if ( false === $test )
     1202                continue;
    12011203            if ( isset( $test['query'] ) )
    12021204                $post_links[] = $link_test;
     
    12161218                // Check to see if we can figure out the mime type from
    12171219                // the extension
    1218                 $url_parts = parse_url( $url );
    1219                 $extension = pathinfo( $url_parts['path'], PATHINFO_EXTENSION );
    1220                 if ( !empty( $extension ) ) {
    1221                     foreach ( get_allowed_mime_types( ) as $exts => $mime ) {
    1222                         if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) {
    1223                             $type = $mime;
    1224                             break;
     1220                $url_parts = @parse_url( $url );
     1221                if ( false !== $url_parts ) {
     1222                    $extension = pathinfo( $url_parts['path'], PATHINFO_EXTENSION );
     1223                    if ( !empty( $extension ) ) {
     1224                        foreach ( get_allowed_mime_types( ) as $exts => $mime ) {
     1225                            if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) {
     1226                                $type = $mime;
     1227                                break;
     1228                            }
    12251229                        }
    12261230                    }
Note: See TracChangeset for help on using the changeset viewer.