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: 2021-08-10 16:43 UTC
From: fooquency at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: Apache2 related
PHP Version: 7.0.8 OS: Ubuntu 16.04
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-08-10 16:43 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2021-08-10 17:30 UTC] rtrtrtrtrt at dfdfdfdf dot dfd
it's nonse using html_errors for LOGGING
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 10:01:29 2024 UTC