#70374file_get_contents default context
Description
In our development environment we have to use a proxy to retrieve data from external web addresses. To do this we use ‘stream_context_set_default’ to set the proxy by default.
In TYPO3 version 7.5 in GeneralUtility::getUrl the context is set (line 2495) without checking a default.
The following code solve our problem:
$ctx = stream_context_create(array(
'http' => array(
'header' => implode(CRLF, $requestHeaders)
)
));
$defaultCtx = stream_context_get_default();
if($defaultCtx) {
$content = @file_get_contents($url);
} else {
$content = @file_get_contents($url, FALSE, $ctx);
}