summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-12-10 15:39:43 +0000
committerDries Buytaert <dries@buytaert.net>2009-12-10 15:39:43 +0000
commitc2f26d3368d38ce4d73aa0089d09d2d78ccf9285 (patch)
tree3db0c442068bd5bfb2a91e26675dfe9019cc8fab /includes
parent3016bcbd235b75e60a44566368c2d3702a625174 (diff)
downloadbrdo-c2f26d3368d38ce4d73aa0089d09d2d78ccf9285.tar.gz
brdo-c2f26d3368d38ce4d73aa0089d09d2d78ccf9285.tar.bz2
- Patch #653940 by sun: tests weren't reporting all errors.
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc14
-rw-r--r--includes/stream_wrappers.inc7
2 files changed, 11 insertions, 10 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 613596ffa..e8734e0c5 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -807,20 +807,16 @@ function drupal_http_request($url, array $options = array()) {
$result = new stdClass();
- // Parse the URL and make sure we can handle the schema.
- $uri = @parse_url($url);
-
- if ($uri == FALSE) {
+ // 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) {
$result->error = 'unable to parse URL';
$result->code = -1001;
return $result;
}
- if (!isset($uri['scheme'])) {
- $result->error = 'missing schema';
- $result->code = -1002;
- return $result;
- }
+ $uri = parse_url($url);
timer_start(__FUNCTION__);
diff --git a/includes/stream_wrappers.inc b/includes/stream_wrappers.inc
index c58c58231..bfbe528b4 100644
--- a/includes/stream_wrappers.inc
+++ b/includes/stream_wrappers.inc
@@ -500,7 +500,12 @@ abstract class DrupalLocalStreamWrapper implements DrupalStreamWrapperInterface
public function url_stat($uri, $flags) {
$this->uri = $uri;
if ($flags & STREAM_URL_STAT_QUIET) {
- return @stat($this->getLocalPath());
+ if (file_exists($this->getLocalPath())) {
+ return stat($this->getLocalPath());
+ }
+ else {
+ return FALSE;
+ }
}
else {
return stat($this->getLocalPath());