Make WordPress Core

Changeset 8545


Ignore:
Timestamp:
08/05/2008 05:45:34 AM (17 years ago)
Author:
ryan
Message:

Suppress fopen errors if WP_DEBUG is not enabled. Props jacobsantos. fixes #7456 see #4779

File:
1 edited

Legend:

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

    r8544 r8545  
    543543        $arrURL = parse_url($url);
    544544
     545        if ( false === $arrURL )
     546            return new WP_Error('http_request_failed', sprintf(__('Malformed URL: %s'), $url));
     547
    545548        if ( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] )
    546549            $url = str_replace($arrURL['scheme'], 'http', $url);
    547550
    548         $handle = fopen($url, 'r');
     551        if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) )
     552            $handle = @fopen($url, 'r');
     553        else
     554            $handle = fopen($url, 'r');
    549555
    550556        if (! $handle)
     
    637643
    638644        $arrURL = parse_url($url);
     645
     646        if ( false === $arrURL )
     647            return new WP_Error('http_request_failed', sprintf(__('Malformed URL: %s'), $url));
    639648
    640649        if ( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] )
     
    657666        $context = stream_context_create($arrContext);
    658667
    659         $handle = fopen($url, 'r', false, $context);
     668        if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) )
     669            $handle = @fopen($url, 'r');
     670        else
     671            $handle = fopen($url, 'r');
    660672
    661673        if ( ! $handle)
Note: See TracChangeset for help on using the changeset viewer.