php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72616 Apache log involving failed file_get_contents includes entities
Submitted: 2016-07-18 13:03 UTC Modified: -
From: fooquency at gmail dot com Assigned:
Status: Open Package: Apache2 related
PHP Version: 7.0.8 OS: Ubuntu 16.04
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-07-18 13:03 UTC] fooquency at gmail dot com
Description:
------------
If a file_get_contents call to an external URL fails, due to e.g. a 404, the error log in Apache shows a version of the requested URL with entities, rather than the actual URL, as if it were intended for display:

PHP Warning:  file_get_contents(http://www.example.com/api?foo=1&bar=2): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found\r\n in /path/to/foo.php on line 3

This means that, after checking the log, the URL cannot be copied-and-pasted from directly.

Test script:
---------------
<?php

echo file_get_contents ('http://www.example.com/api?foo=1&bar=2');

?>

Expected result:
----------------
PHP Warning:  file_get_contents(http://www.example.com/api?foo=1&bar=2): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found\r\n in /path/to/foo.php on line 3

Actual result:
--------------
PHP Warning:  file_get_contents(http://www.example.com/api?foo=1&amp;bar=2): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found\r\n in /path/to/foo.php on line 3

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Aug 19 01:01:26 2019 UTC