Bug #70374

file_get_contents default context

Added by Ronald Klomp almost 4 years ago. Updated almost 2 years ago.

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

100%

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

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

Associated revisions

Revision b4813ddb (diff)
Added by Josef F. Glatz (Old User) almost 4 years ago

[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 <>
Reviewed-by: Ronald Klomp <>
Tested-by: Ronald Klomp <>
Reviewed-by: Eva Wiggers <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

Revision 9543b7f8 (diff)
Added by Sascha Egerer over 3 years ago

[BUGFIX] Reallow custom request context in getUrl

In b4813ddb55ab789ddd13e02234f147a44d2af1ed an patch
has been introduced which respects the default stream context
when requesting urls. But the change prevents that custom
stream options (headers) can be set.

The default stream context should be used and extended by the
given custom headers.

Change-Id: I6ec6d23498e194055cefc1c6c63db7c161ee03c6
Resolves: #72907
Related: #70374
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/46208
Reviewed-by: Stephan Gro├čberndt <>
Reviewed-by: Frank Naegler <>
Tested-by: Frank Naegler <>
Reviewed-by: Claus Due <>
Reviewed-by: Ralf Merz <>
Reviewed-by: Andreas Fernandez <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

Revision d2f92e9a (diff)
Added by Sascha Egerer over 3 years ago

[BUGFIX] Reallow custom request context in getUrl

In b4813ddb55ab789ddd13e02234f147a44d2af1ed an patch
has been introduced which respects the default stream context
when requesting urls. But the change prevents that custom
stream options (headers) can be set.

The default stream context should be used and extended by the
given custom headers.

Change-Id: I6ec6d23498e194055cefc1c6c63db7c161ee03c6
Resolves: #72907
Related: #70374
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/46668
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

History

#1 Updated by Gerrit Code Review almost 4 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

#2 Updated by Josef F. Glatz (Old User) almost 4 years ago

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

#3 Updated by Riccardo De Contardi almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF