php.net |  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
Votes:2
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
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 — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
31 - 31 = ?
Subscribe to this entry?

 
 [2016-01-01 16:38 UTC] salsi at icosaedro dot it
Description:
------------
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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] requinix@php.net
-Package: Documentation problem +Package: Bzip2 Related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 07:01:31 2024 UTC