Check return values to catch error earlier, and while at it also emit
more error messages in case of failures.
CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_USERAGENT => Tweeper::$userAgent,
));
CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_USERAGENT => Tweeper::$userAgent,
));
+
+ $ret = curl_exec($ch);
+ if (FALSE === $ret) {
+ trigger_error(curl_error($ch));
+ curl_close($ch);
+ return FALSE;
+ }
+
$url_info = curl_getinfo($ch);
if (FALSE === $url_info) {
trigger_error(curl_error($ch));
$url_info = curl_getinfo($ch);
if (FALSE === $url_info) {
trigger_error(curl_error($ch));
);
$url_info = Tweeper::getUrlInfo($url);
);
$url_info = Tweeper::getUrlInfo($url);
+ if (FALSE === $url_info) {
+ error_log("Failed to retrieve info for URL: " . $url);
+ return '';
+ }
$supported = in_array($url_info['content_type'], $supported_content_types);
if (!$supported) {
$supported = in_array($url_info['content_type'], $supported_content_types);
if (!$supported) {
}
$stylesheet_contents = Tweeper::getUrlContents($stylesheet);
}
$stylesheet_contents = Tweeper::getUrlContents($stylesheet);
+ if (FALSE === $stylesheet_contents) {
+ return NULL;
+ }
$xslDoc = new DOMDocument();
$xslDoc->loadXML($stylesheet_contents);
$xslDoc = new DOMDocument();
$xslDoc->loadXML($stylesheet_contents);