I was almost discouraged when I didn't find a gzdecode() function! However, fear not, for I'll contribute my work... :)
function alt_gzdecode($str) {
// seed with microseconds since last "whole" second.
mt_srand((float)microtime()*1000000);
$eh="/tmp/php-" . md5(mt_rand(0,mt_getrandmax())) . ".gz";
$fd=fopen($eh,"w");
fwrite($fd,$str);
fclose($fd);
$fd = gzopen ($eh, "r");
$str=gzpassthru($fd);
unlink($eh);
return $str;
}
It's only ugly point is that it does not check to see if the file already exists. You may also have to adjust reference names like $str and $fd if they stomp on your code. (Sorry, but this is all you get atm! ;} ) If your conserned about a race condition, cry for a internal gzdecode() function that actualy functions...
I spent about 3 hours straight debugging this problem. I know the input data was valid, becuase I validated it with MD5() to compare to the md5's I had made of the input data before hand. I'm not sure whats up with gzuncompress or gzinflate, but this works in its place . . .
Enjoy!