php.net |  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
 [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...]";
echo
  strlen($str) . " " .
  strlen(gzcompress($str,9)) . " " .
  strlen(bzcompress($str,9));
?>

This generates the output: 14092 2348 14092

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 16:01:28 2024 UTC