php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78482 fgets notice from 7.4-beta2: read of 8192 bytes failed with errno=9 Bad file d
Submitted: 2019-08-31 10:59 UTC Modified: 2019-08-31 11:32 UTC
From: julien dot boudry at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 7.4.0beta4 OS: Windows 10 - Non Thread Safe
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: julien dot boudry at gmail dot com
New email:
PHP Version: OS:

 

 [2019-08-31 10:59 UTC] julien dot boudry at gmail dot com
Description:
------------
Hi,

From PHP 7.4-beta2 (it's working on beta1), the following notice appears on fgets :

read of 8192 bytes failed with errno=9 Bad file descriptor in /in/TR1Bk on line 7

It also works on stable versions.

https://3v4l.org/TR1Bk

Test script:
---------------
<?php

    $tempName = tempnam(sys_get_temp_dir(), 'test');

    $handle = fopen($tempName, 'w');

    $line = fgets($handle);

    fclose($handle);

Actual result:
--------------
Notice: fgets(): read of 8192 bytes failed with errno=9 Bad file descriptor in /in/TR1Bk on line 7

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-08-31 11:32 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2019-08-31 11:32 UTC] nikic@php.net
This is an intentional change. You are trying to read from a write-only stream, which is no longer silently ignored.

This is mentioned in https://github.com/php/php-src/blob/77a0fa101ed59f05ea07b03adb1cb66962fc45e7/UPGRADING#L149-L150, though should probably be extended to also mention other file-system and functions.
 [2019-08-31 12:04 UTC] julien dot boudry at gmail dot com
Indeed. But the documentation and especially the changelog of the beta2 were not clear to me, for this situation. Thank you very much.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 14:01:29 2024 UTC