Try to detect gzopen64 function

This commit is contained in:
RainLoop Team 2014-05-18 15:41:42 +04:00
parent d3ee36bb97
commit 71af876fb5
6 changed files with 11473 additions and 5754 deletions

File diff suppressed because it is too large Load diff

View file

@ -204,6 +204,8 @@
// The class can then disable the magic_quotes and reset it after
var $magic_quotes_status;
var $bUseGzopen64;
// --------------------------------------------------------------------------------
// Function : PclZip()
// Description :
@ -216,11 +218,13 @@
{
// ----- Tests the zlib
if (!function_exists('gzopen'))
if (!function_exists('gzopen') && !function_exists('gzopen64'))
{
die('Abort '.basename(__FILE__).' : Missing zlib extensions');
}
$this->bUseGzopen64 = !function_exists('gzopen') && function_exists('gzopen64');
// ----- Set the attributes
$this->zipname = $p_zipname;
$this->zip_fd = 0;
@ -2811,11 +2815,22 @@
// ----- Creates a compressed temporary file
$v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
if ($this->bUseGzopen64)
{
if (($v_file_compressed = @gzopen64($v_gzip_temp_name, "wb")) == 0) {
fclose($v_file);
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
return PclZip::errorCode();
}
}
else
{
if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) {
fclose($v_file);
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
return PclZip::errorCode();
}
}
// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
$v_size = filesize($p_filename);
@ -4005,13 +4020,24 @@
}
// ----- Open the temporary gz file
if ($this->bUseGzopen64)
{
if (($v_src_file = @gzopen64($v_gzip_temp_name, 'rb')) == 0) {
@fclose($v_dest_file);
$p_entry['status'] = "read_error";
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
return PclZip::errorCode();
}
}
else
{
if (($v_src_file = @gzopen($v_gzip_temp_name, 'rb')) == 0) {
@fclose($v_dest_file);
$p_entry['status'] = "read_error";
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
return PclZip::errorCode();
}
}
// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
$v_size = $p_entry['size'];

View file

@ -9,7 +9,7 @@
'DateTime' => class_exists('DateTime') && class_exists('DateTimeZone'),
'libxml' => function_exists('libxml_use_internal_errors'),
'dom' => class_exists('DOMDocument'),
'Zlib' => function_exists('gzopen'),
'Zlib' => function_exists('gzopen') || function_exists('gzopen64'),
'PCRE' => function_exists('preg_replace'),
'SPL' => function_exists('spl_autoload_register')
);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long