Bug #72616 [Opn->Nab]: Apache log involving failed file_get_contents includes entities

From: Date: Tue, 10 Aug 2021 16:43:46 +0000
Subject: Bug #72616 [Opn->Nab]: Apache log involving failed file_get_contents includes entities
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235744@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
 Updated by:         cmb@php.net
 Reported by:        fooquency at gmail dot com
 Summary:            Apache log involving failed file_get_contents
                     includes entities
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Apache2 related
 Operating System:   Ubuntu 16.04
 PHP Version:        7.0.8
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Disable html_errors[1].

[1] <https://www.php.net/manual/en/errorfunc.configuration.php#ini.html-errors>


Previous Comments:
------------------------------------------------------------------------
[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&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

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


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=72616&edit=1


Thread (3 messages)

« previous php.bugs (#235744) next »