|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75526 fread behavior change in 7.2
Submitted: 2017-11-14 18:43 UTC Modified: 2017-11-15 14:29 UTC
From: ryan dot brothers at gmail dot com Assigned:
Status: Duplicate Package: Streams related
PHP Version: 7.2.0RC6 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
30 - 21 = ?
Subscribe to this entry?

 [2017-11-14 18:43 UTC] ryan dot brothers at gmail dot com
I noticed the following behavior changed when using fread with stdin in PHP 7.2.  I think the new behavior is correct based on the manual page for fread, but I didn't see it noted as a change in the release notes unless I missed it.

When running the below script in CLI, enter the text "abc" and press enter.

In PHP 7.1, the script immediately exits and prints the line you entered.

In PHP 7.2, the script prompts you for another line of text.  You have to press Control-D to exit out of it, and then all lines are printed.

Test script:
echo fread(STDIN, 1000);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-11-14 18:53 UTC]
Maybe related to #75515?
 [2017-11-14 19:02 UTC] ryan dot brothers at gmail dot com
Yes, looks to be similar.
 [2017-11-15 14:29 UTC]
-Status: Open +Status: Duplicate
 [2017-11-15 14:29 UTC]
Closing, as indeed fixed in PHP-7.2 branch
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Sep 22 03:01:24 2020 UTC