ID: 14939
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Feedback
Bug Type: Zlib Related
Operating System: Apache
PHP Version: 4.1.1
-Assigned To:
+Assigned To: sr
New Comment:
Does the attached patch help?
--- /home/sr/cvs/php/php4/ext/zlib/zlib.c Thu Mar 7 16:38:26
2002
+++ ext/zlib/zlib.c Thu Mar 7 23:15:48 2002
@@ -967,7 +967,7 @@
if(! s2) { if(s1) efree(s1); RETURN_FALSE; }
stream.next_in = (Bytef*) Z_STRVAL_PP(data);
- stream.avail_in = (uInt) Z_STRLEN_PP(data);
+ stream.avail_in = (uInt) Z_STRLEN_PP(data) + 1; /*
there is room for \0 */
stream.next_out = s2;
stream.avail_out = (uInt) length;
(If there are broken line breaks and you can't apply it, change the
line stream.avail_in = (uInt) Z_STRLEN_PP(data) to ...(data)+1 in the
gzinflate function).
Please report if it works (and if it doesn't break other things). This
seems to be a rather strange thing in the zlib library ...
Previous Comments:
------------------------------------------------------------------------
[2002-03-07 08:06:33] [EMAIL PROTECTED]
Does this script work if you don't provide a compression level?
-- robin
------------------------------------------------------------------------
[2002-01-08 21:04:16] [EMAIL PROTECTED]
Receive the following error with only 15 consecutive characters
entered.
Warning: gzinflate: buffer error in
/usr/local/apache/elca_rmg/class.FTemplateExt.php on line 153
What follows is the code updating the SQL files:
$gzsize = strlen($description) + 4; // added 4 more than req'd
$gzcompress = gzdeflate ($description,6);
$gzcompress = addslashes($gzcompress); //Reqd for SQL updates
$query = "UPDATE htmlcontent SET record_nbr = \"$record_nbr\",
gzcompress = \"$gzcompress\", gzsize = $gzsize WHERE record_nbr =
\"$record_nbr\"";
}
general_update($errno,$errmsg,$rowsaffected, $result, $s_synod_id,
$query); // UPDATE the record
*******************************************************
Next I attempt to read the record back and unzip gzcompress
Note that $description consists of 20 'a' characters. Any repetitive
char will do and only 15 to 20 are req'd
*******************************************************
$query = "SELECT * FROM htmlcontent WHERE record_nbr =
\"$record_nbr\"";
general_read($errno, $errmsg,$numrows, $result_html, $s_synod_id,
$query);
if ($numrows > 0) {
if ($row_html = mysql_fetch_array ($result_html)) {
$content = stripslashes($row_html["gzcompress"]);
if (strlen($content) > 0) {
******Error occurs on the following instruction*********
$new = gzinflate($content,$row_html["gzsize"]);
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=14939&edit=1