From b4813ddb55ab789ddd13e02234f147a44d2af1ed Mon Sep 17 00:00:00 2001
From: Josef Glatz <jousch@gmail.com>
Date: Mon, 5 Oct 2015 11:34:40 +0200
Subject: [PATCH] [BUGFIX] file_get_contents default context

Check for default stream context.

Resolves: #70374
Releases: master
Change-Id: I88a3f49fa121e713707d54d7696ba1233a475220
Reviewed-on: http://review.typo3.org/43810
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Ronald Klomp <rklomp@zigwebsoftware.nl>
Tested-by: Ronald Klomp <rklomp@zigwebsoftware.nl>
Reviewed-by: Eva Wiggers <eva_wiggers@hotmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 typo3/sysext/core/Classes/Utility/GeneralUtility.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/core/Classes/Utility/GeneralUtility.php b/typo3/sysext/core/Classes/Utility/GeneralUtility.php
index eda5b7f639d2..59b67179f8f8 100755
--- a/typo3/sysext/core/Classes/Utility/GeneralUtility.php
+++ b/typo3/sysext/core/Classes/Utility/GeneralUtility.php
@@ -2495,7 +2495,12 @@ Connection: close
 					'header' => implode(CRLF, $requestHeaders)
 				)
 			));
-			$content = @file_get_contents($url, FALSE, $ctx);
+			$defaultCtx = stream_context_get_default();
+			if ($defaultCtx) {
+				$content = @file_get_contents($url);
+			} else {
+				$content = @file_get_contents($url, FALSE, $ctx);
+			}
 			if ($content === FALSE && isset($report)) {
 				$report['error'] = -1;
 				$report['message'] = 'Couldn\'t get URL: ' . (isset($http_response_header) ? implode(LF, $http_response_header) : $url);
-- 
GitLab