Bug #72616 [Com]: Apache log involving failed file_get_contents includes entities
| From: | rtrtrtrtrt at dfdfdfdf dot dfd | Date: | Tue, 10 Aug 2021 17:30:18 +0000 |
| Subject: | Bug #72616 [Com]: Apache log involving failed file_get_contents includes entities | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-235745@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72616&edit=1
ID: 72616
Comment by: rtrtrtrtrt at dfdfdfdf dot dfd
Reported by: fooquency at gmail dot com
Summary: Apache log involving failed file_get_contents
includes entities
Status: Not a bug
Type: Bug
Package: Apache2 related
Operating System: Ubuntu 16.04
PHP Version: 7.0.8
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
it's nonse using html_errors for LOGGING
Previous Comments:
------------------------------------------------------------------------
[2021-08-10 16:43:46] cmb@php.net
Disable html_errors[1].
[1] <https://www.php.net/manual/en/errorfunc.configuration.php#ini.html-errors>
------------------------------------------------------------------------
[2016-07-18 13:03:57] 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&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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72616&edit=1