WordPress.org

Plugin Directory

Changeset 650354


Ignore:
Timestamp:
01/09/13 19:12:08 (16 months ago)
Author:
cfinke
Message:

Photon: Confirm that URL parsing succeeded before processing an image URL.

Also, suppress messages from parse_url, since in PHP versions before 5.3.3, it emitted a warning when parsing failed. (Why emit a warning when the return value suffices? Beats me.)

See http://wordpress.org/support/topic/photon-error-classphotonphp-line-397?replies=2#post-3705159

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/class.photon.php

    r649241 r650354  
    406406     */ 
    407407    protected static function validate_image_url( $url ) { 
     408        $parsed_url = @parse_url( $url ); 
     409 
     410        if ( ! $parsed_url ) 
     411            return false; 
     412 
    408413        // Parse URL and ensure needed keys exist, since the array returned by `parse_url` only includes the URL components it finds. 
    409         $url_info = wp_parse_args( parse_url( $url ), array( 
     414        $url_info = wp_parse_args( $parsed_url, array( 
    410415            'scheme' => null, 
    411416            'host'   => null, 
Note: See TracChangeset for help on using the changeset viewer.