[BUGFIX] file_get_contents default context 10/43810/2
authorJosef Glatz <jousch@gmail.com>
Mon, 5 Oct 2015 09:34:40 +0000 (11:34 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 8 Oct 2015 19:32:32 +0000 (21:32 +0200)
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

index eda5b7f..59b6717 100755 (executable)
@@ -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);