Project

General

Profile

Actions

Bug #70374

closed

file_get_contents default context

Added by Ronald Klomp over 8 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
Start date:
2015-10-05
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.5
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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);
            }

Related issues 1 (0 open1 closed)

Precedes TYPO3 Core - Bug #72907: file_get_contents does not respect custom headers anymoreClosed2016-01-24

Actions
Actions #1

Updated by Gerrit Code Review over 8 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/43810

Actions #2

Updated by Josef F. Glatz (Old User) over 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #3

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF