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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: fooquency at gmail dot com
New email:
PHP Version: OS:

 

 [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: Wed Dec 11 13:01:24 2019 UTC