|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-01-03 13:18 UTC] 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
><
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 20 21:00:02 2025 UTC |
But is_readable("/sys/class/net/lo/speed") returns true Try: <?php $fname = "/sys/class/net/lo/speed"; $file = fopen($fname, "r"); if (is_readable($fname)) { echo ">".fgets($file, 2048)."<"; } else { echo "File is not readable"; } fclose($file);