note 94325 added to function.gzinflate
| From: | vitall at ua dot fm | Date: | Thu, 29 Oct 2009 00:08:30 +0000 |
| Subject: | note 94325 added to function.gzinflate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-162212@lists.php.net to get a copy of this message | ||
Upgrade decode_gzip function, see below.
The Data can be damaged and other some moments.
In the same way in functions gzinflate there is Bug which is removed only in the most modern php
version.
<?php
function decode_gzip($h,$d,$rn="\r\n"){
if (isset($h['Transfer-Encoding'])){
$lrn = strlen($rn);
do{
@$p = strpos($d,$rn,$ofs);
if($p===false){$str=''; break;}
$len = hexdec(substr($d,$ofs,$p-$ofs));
$str .= substr($d,$p+$lrn,$len);
$ofs = $p+$lrn*2+$len;
}while ($d[$ofs]!=='0');
$d=$str;
}
//$slupd = unpack('L',substr($d,-4));
if (isset($h['Content-Encoding']))
{
static $lim_mem;
if(!$lim_mem) $lim_mem = ini_get('memory_limit')<<18;
@$d = gzinflate(substr($d,10),$lim_mem);
}
return $d;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 109.86.117.227
----
Manual Page -- http://www.php.net/manual/en/function.gzinflate.php
Edit -- https://master.php.net/note/edit/94325
Del: integrated -- https://master.php.net/note/delete/94325/integrated
Del: useless -- https://master.php.net/note/delete/94325/useless
Del: bad code -- https://master.php.net/note/delete/94325/bad+code
Del: spam -- https://master.php.net/note/delete/94325/spam
Del: non-english -- https://master.php.net/note/delete/94325/non-english
Del: in docs -- https://master.php.net/note/delete/94325/in+docs
Del: other reasons-- https://master.php.net/note/delete/94325
Reject -- https://master.php.net/note/reject/94325
Search -- https://master.php.net/manage/user-notes.php