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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
45 + 21 = ?
Subscribe to this entry?

 
 [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

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: Fri Apr 26 02:01:29 2024 UTC