Bug #81035 [Opn->Nab]: file_get_contents emits not silenceable warning on http file not exists

From: Date: Wed, 12 May 2021 09:54:06 +0000
Subject: Bug #81035 [Opn->Nab]: file_get_contents emits not silenceable warning on http file not exists
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233807@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81035&edit=1 ID: 81035 Updated by: nikic@php.net Reported by: shop1 at mokraemer dot de Summary: file_get_contents emits not silenceable warning on http file not exists -Status: Open +Status: Not a bug Type: Bug Package: Filesystem function related Operating System: linux PHP Version: 8.0.6 Block user comment: N Private report: N New Comment: You may wish to either suppress the warning using "@" (if you do not care about it), or promote it to an exception using an error handler. The existing behavior will not be changed for backwards-compatibility reasons. Previous Comments: ------------------------------------------------------------------------ [2021-05-12 09:46:30] shop1 at mokraemer dot de Description: ------------ file_get_contents emits a warning instead of an exception if the file does not exist! This may be a good choice if the file is local where you can test for file existence. In case of remote files via http, this is quite not possible. Since the silence operator does not work anymore, this raises undesireable errors in the logs. Test script: --------------- file_get_contents('https://www.google.com/rss.xml'); Expected result: ---------------- do not emit warnings. Just throw exceptions! Actual result: -------------- the emitted warning is filling the logs and does not help! ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81035&edit=1

« previous php.bugs (#233807) next »