|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #71258 bzread(): detailed description of the returned values and errors
Submitted: 2016-01-01 16:38 UTC Modified: 2016-01-02 00:57 UTC
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: salsi at icosaedro dot it Assigned:
Status: Open Package: Bzip2 Related
PHP Version: Irrelevant OS:
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.
Bug Type:
From: salsi at icosaedro dot it
New email:
PHP Version: OS:


 [2016-01-01 16:38 UTC] salsi at icosaedro dot it
The "return value" section of the page describing bzread() shoutd explain more in detail what really this function may return:

- FALSE: error reading from the stream. An error of level E_WARNING is also raised in this case; you may retrieve the text of the error message from the $php_errormsg magic variable, if enabled.

- Empty string: end of the file or BZIP2 deconding error. Use feof($bz) to detect the first case, and use bzerrno($bz) != 0 to detect the latter.

- Non empty string: decoded data. Check bzerror($bz) != 0 for possible BZIP2 decoding errors. Data may still be garbage because the BZIP2 checksum is checked only after a whole block of BZIP2 data has been read or at the end of the stream, so in general data read cannot be trusted until the whole content of the file has been read.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-01 18:24 UTC] salsi at icosaedro dot it
-Type: Bug +Type: Documentation Problem
 [2016-01-01 18:24 UTC] salsi at icosaedro dot it
Fix my report: Bug --> Documentation Problem.
 [2016-01-02 00:57 UTC]
-Package: Documentation problem +Package: Bzip2 Related
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 20:01:26 2020 UTC