Hay un problema con la función de PHP gunzip () que en las primeras versiones de PHP 5 se sabe que hace demanda de mucha memoria e innecesaria en algunas circunstancias.
Este error es susceptible por Joomla en algunas versiones en el rango de PHP 5.1.x .
Además, hay un problema con una parte del código de Joomla.
Además, para los sitios usando PHP 5.2.0 o posterior Joomla usaría funciones de PHP para descomprimir archivos zip, pero con versiones anteriores se utiliza el código de Joomla.
Un problema se presenta finalmente a la clase JFile y su método de lectura. Se puede encontrar en la ruta del root de joomla ....
/libraries/joomla/filesystem/file.php. El método de lectura viejo es:
Código PHP:
function read($filename, $incpath = false, $amount = 0,
$chunksize = 8192, $offset = 0)
{
// Initialize variables
$data = null;
if($amount && $chunksize > $amount) { $chunksize = $amount; }
if (false === $fh = fopen($filename, 'rb', $incpath)) {
JError::raiseWarning(21, 'JFile::read: '.
JText::_('Unable to open file') . ": '$filename'");
return false;
}
clearstatcache();
if($offset) fseek($fh, $offset);
if ($fsize = @ filesize($filename)) {
if($amount && $fsize > $amount) {
$data = fread($fh, $amount);
} else {
$data = fread($fh, $fsize);
}
} else {
$data = '';
$x = 0;
// While its:
// 1: Not the end of the file AND
// 2a: No Max Amount set OR
// 2b: The length of the data is less than the max amount
// we want
while (!feof($fh) && (!$amount || strlen($data) < $amount)) {
$data .= fread($fh, $chunksize);
}
}
fclose($fh);
return $data;
}
Esto no esta especialmente bien escrito, y podemos ver que no funciona correctamente para un archivo de más de 8192 bytes. Puede ser sustituido por:
Código PHP:
function read($filename, $incpath = false, $amount = 0,
$chunksize = 8192, $offset = 0)
{
// Initialize variables
if (false === $fh = fopen($filename, 'rb', $incpath)) {
JError::raiseWarning(21, 'JFile::read: '.
JText::_('Unable to open file') . ": '$filename'");
return false;
}
if($offset) fseek($fh, $offset);
$data = '';
// While its:
// 1: Not the end of the file AND
// 2a: No Max Amount set OR
// 2b: The length of the data is less than the max amount we want
while (!feof($fh) AND $trysize = $amount ?
min($chunksize, ($amount - strlen($data))) : $chunksize) {
$data .= fread($fh, $trysize);
}
fclose($fh);
return $data;
}
que parece proporcionar la funcionalidad deseada. Con este código en su lugar, se puede instalar cualquiera de los archivos zip o tar.gz.
Fuente::
Martin Brampton
Un saludo