|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9503 bzcompress output is null padded to size of original string
Submitted: 2001-02-28 16:58 UTC Modified: 2001-03-15 20:27 UTC
From: zeekamotay at hotmail dot com Assigned:
Status: Closed Package: Bzip2 Related
PHP Version: 4.0.4pl1 OS: Linux 2.2 [RH6.2]
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: zeekamotay at hotmail dot com
New email:
PHP Version: OS:


 [2001-02-28 16:58 UTC] zeekamotay at hotmail dot com
I compiled PHP 4.0.4pl1 with --bz2, using bzip 1.0.1. Running bzcompress() on a string always returns a string of the same size. The data in the returned string appears to be correctlty compressed though, as it uncompresses correctly when passed back to bzdecompress(). It appears that the first part of the returned string contains the correctly compressed result, and that the returned string is then padded with nulls out to the size of the original string. The gzcompress() function does not behave this way.

$str = "[...some really huge string...]";
  strlen($str) . " " .
  strlen(gzcompress($str,9)) . " " .

This generates the output: 14092 2348 14092


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-15 20:27 UTC]
Fixed in CVS.


PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Feb 19 22:01:28 2020 UTC