public function getFinalUrl() {
$headers = $this->getResponseHeaders();
- //return full url (fix for incorrect but handled relative location)
+ // return full url (fix for incorrect but handled relative location)
if ( isset( $headers['location'] ) ) {
$locations = $headers['location'];
$domain = '';
if ( isset( $url['host'] ) ) {
$domain = $url['scheme'] . '://' . $url['host'];
- break; //found correct URI (with host)
+ break; // found correct URI (with host)
} else {
$foundRelativeURI = true;
}
* @return bool
*/
public function canFollowRedirects() {
- if ( strval( ini_get( 'open_basedir' ) ) !== '' || wfIniGetBool( 'safe_mode' ) ) {
- wfDebug( "Cannot follow redirects in safe mode\n" );
- return false;
- }
-
$curlVersionInfo = curl_version();
if ( $curlVersionInfo['version_number'] < 0x071304 ) {
wfDebug( "Cannot follow redirects with libcurl < 7.19.4 due to CVE-2009-0037\n" );
return false;
}
+ if ( version_compare( PHP_VERSION, '5.6.0', '<' ) ) {
+ if ( strval( ini_get( 'open_basedir' ) ) !== '' || wfIniGetBool( 'safe_mode' ) ) {
+ wfDebug( "Cannot follow redirects in safe mode\n" );
+ return false;
+ }
+ }
+
return true;
}
}
) );
}
- foreach( $certLocations as $key => $cert ) {
+ foreach ( $certLocations as $key => $cert ) {
if ( is_dir( $cert ) ) {
$certOptions['capath'] = $cert;
break;