diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-12-15 05:22:05 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-12-15 05:22:05 +0000 |
commit | 8e38d459e5946d51c16bce3355ec5393143c8824 (patch) | |
tree | fc9e1dbc6f9751e9d61bbda927b7246ef87f339f /includes | |
parent | eb807e70e030a19e4b72984a955d0412a9f9b463 (diff) | |
download | brdo-8e38d459e5946d51c16bce3355ec5393143c8824.tar.gz brdo-8e38d459e5946d51c16bce3355ec5393143c8824.tar.bz2 |
#653940 follow-up by Damien Tournoud: Clean-up of error handling from first stab at test reporting fixes.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 14 | ||||
-rw-r--r-- | includes/stream_wrappers.inc | 7 |
2 files changed, 10 insertions, 11 deletions
diff --git a/includes/common.inc b/includes/common.inc index 66464963a..8ff820452 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -807,16 +807,20 @@ function drupal_http_request($url, array $options = array()) { $result = new stdClass(); - // Validate the passed URL. FILTER_VALIDATE_URL uses parse_url() internally, - // but unlike parse_url() itself, it will not throw a run-time notice for - // bogus URLs. - if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) { + // Parse the URL and make sure we can handle the schema. + $uri = @parse_url($url); + + if ($uri == FALSE) { $result->error = 'unable to parse URL'; $result->code = -1001; return $result; } - $uri = parse_url($url); + if (!isset($uri['scheme'])) { + $result->error = 'missing schema'; + $result->code = -1002; + return $result; + } timer_start(__FUNCTION__); diff --git a/includes/stream_wrappers.inc b/includes/stream_wrappers.inc index bfbe528b4..c58c58231 100644 --- a/includes/stream_wrappers.inc +++ b/includes/stream_wrappers.inc @@ -500,12 +500,7 @@ abstract class DrupalLocalStreamWrapper implements DrupalStreamWrapperInterface public function url_stat($uri, $flags) { $this->uri = $uri; if ($flags & STREAM_URL_STAT_QUIET) { - if (file_exists($this->getLocalPath())) { - return stat($this->getLocalPath()); - } - else { - return FALSE; - } + return @stat($this->getLocalPath()); } else { return stat($this->getLocalPath()); |