Bug #79060 [Opn->Fbk]: fgets errno=22
| From: | nikic@php.net | Date: | Fri, 03 Jan 2020 14:43:19 +0000 |
| Subject: | Bug #79060 [Opn->Fbk]: fgets errno=22 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224689@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79060&edit=1
ID: 79060
Updated by: nikic@php.net
Reported by: namiltd at yahoo dot com
Summary: fgets errno=22
-Status: Open
+Status: Feedback
Type: Bug
Package: *General Issues
Operating System: Debian GNU/Linux 9
PHP Version: 7.4.1
Block user comment: N
Private report: N
New Comment:
What is the bug here? The fgets() fails because the "file" is not readable. Since PHP 7.4,
file system read/write failures result in a notice and false return value (this is noted in the
upgrading notes).
Previous Comments:
------------------------------------------------------------------------
[2020-01-03 13:24:07] namiltd at yahoo dot com
E-mail change
------------------------------------------------------------------------
[2020-01-03 13:18:57] namiltd at yahoo dot com
Description:
------------
Unexpected notice: Notice: fgets(): read of 8192 bytes failed with errno=22 Invalid argument in
/home/www/test.php on line 3
Interestingly, the buffer is 2048 but indicates 8192
Test script:
---------------
<?php
$file = fopen("/sys/class/net/lo/speed","r");
echo ">".fgets($file, 2048)."<";
fclose($file);
?>
Expected result:
----------------
><
Actual result:
--------------
Notice: fgets(): read of 8192 bytes failed with errno=22 Invalid argument in /home/www/test.php on
line 3
><
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79060&edit=1