Bug #16068
closedOut of Memory Problem in the Extension Manager: version_compare() to blame
0%
Description
I have the PRoblem that the original Extension Manager failed with Out of Memory Problem PHP Message. Allocation failed. He also try to allocate few gigs of Ram and it not help. If found also that the implode function was not used correct by this class twice. I fixed the code with the knowledge i have about this class and describle the code changes as follow.
The follow code are alredy changed code. It is not the original code! This changed solved both Problems on my side.
File: typo3/mod/tools/em/class.em_index.php
Line 1394:
/* * Implode Parameter was wrong * */
$mirrors = implode(chr(10), gzfile($mfile));
t3lib_div::unlink_tempfile($mfile);
Line: 1425
/* * Implode Parameter was wrong * */
$mirrors = implode(chr(10), gzfile($mfile));
t3lib_div::unlink_tempfile($mfile);
Line: 2976:
/* * OUT OF MEMORY BUG START HERE */
if(strlen($emConf['PHP_version'])) {
$versionRange = $this->splitVersionRange($emConf['PHP_version']);
//if(version_compare($versionRange0,'3.0.0','<')) $versionRange0 = '3.0.0';
//if(version_compare($versionRange1,'3.0.0','<')) $versionRange1 = '';
$emConf['constraints']['depends']['php'] = implode('-',$versionRange);
}
if(strlen($emConf['TYPO3_version'])) {
$versionRange = $this->splitVersionRange($emConf['TYPO3_version']);
//if(version_compare($versionRange0,'3.5.0','<')) $versionRange0 = '3.5.0';
//if(version_compare($versionRange1,'3.5.0','<')) $versionRange1 = '';
$emConf['constraints']['depends']['typo3'] = implode('-',$versionRange);
}
/ * OUT OF MEMORY BUG STOP HERE * */
(issue imported from #M3302)
Updated by Karl Bauer over 18 years ago
Follow item is wrong in above Ticket, here is the correct one:
Line: 1425
t3lib_div::writeFile(PATH_site.'typo3temp/extensions.xml.gz', $extXML);
/* * Implode Parameter was wrong * */
$content .= $this->xmlhandler->parseExtensionsXML(implode('', gzfile(PATH_site.'typo3temp/extensions.xml.gz'))
$this->xmlhandler->saveExtensionsXML();
Updated by Simon Child over 18 years ago
File typo3/mod/tools/em/class.em_index.php at lines 1392, 1424 contains a useage of implode which is incompatible with php <4.3.0.
This is detailed here: http://uk.php.net/implode "Note: As of PHP 4.3.0, the glue parameter of implode() is optional and defaults to the empty string(''). This is not the preferred usage of implode(). We recommend to always use two parameters for compatibility with older versions."
Reinserting the missing glue parameter should restore compatibility with older versions of php
Updated by Martin Kutschker over 18 years ago
Simply removing a check doesn't seem a proper solution for me, so version_compare stays in. But the implode has been fixed in CVS.
Updated by Karsten Dambekalns over 18 years ago
As Martin says the implode() bug is fixed (thanks Martin!) but the version_compare simply cannot be the cause for the memory problems... unless you have a PHP version where the code you commented behaves extremely strange.
Updated by Karl Bauer over 18 years ago
I think also that this work around will not be the proper solution finally. The Problem seems really to be located in the PHP function version_compare(). The big question for me is if this error can be reporduced by a another installation of Typo3 that uses the PHP version 4.2.2. I will try to update our PHP version on the server but i can not give an time estimation for it. Time is very limited in our company for such bigger changes like the replacement of an PHP version is.
Updated by Martin Kutschker over 18 years ago
I have change the summary to reflect the open issue. I still wonder why the calls to version_compare() produce your problems, but hey, I haven't run PHP 4.2 for a long time.
Sidenote: I don't think that upgrading from 4.2.x to 4.4.x is a big deal.
Updated by J Weber about 18 years ago
Same problem on Typo3 Version 4.0.1 and PHP Version 4.3.10
Code changes show no effect.
Updated by Sebastian Kurfuerst about 18 years ago
Hi, is the problem fixed when you use the extension kb_test_em instead?
Greets, Sebastian