Skip to content

Commit

Permalink
Detect failure of curl_init
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Dec 5, 2014
1 parent 974295a commit 61fcf21
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions libraries/Util.class.php
Expand Up @@ -4252,6 +4252,9 @@ public static function getLatestVersion()
);
} else if (function_exists('curl_init')) {
$curl_handle = curl_init($file);
if ($curl_hadle === false) {
return array();
}
$curl_handle = PMA_Util::configureCurl($curl_handle);
curl_setopt(
$curl_handle,
Expand Down
3 changes: 3 additions & 0 deletions libraries/error_report.lib.php
Expand Up @@ -210,6 +210,9 @@ function PMA_sendErrorReport($report)
}

$curl_handle = curl_init(SUBMISSION_URL);
if ($curl_hadle === false) {
return null;
}
$curl_handle = PMA_Util::configureCurl($curl_handle);
curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array('Expect:'));
Expand Down
16 changes: 10 additions & 6 deletions version_check.php
Expand Up @@ -16,11 +16,15 @@

$version = PMA_Util::getLatestVersion();

echo json_encode(
array(
'version' => $version->version,
'date' => $version->date,
)
);
if (empty($version_data)) {
echo json_encode(array());
} else {
echo json_encode(
array(
'version' => $version->version,
'date' => $version->date,
)
);
}

?>

0 comments on commit 61fcf21

Please sign in to comment.