Issue Bug Closed

#18926class.tx_impexp.php sets 256m memory_limit without checking php.ini

Sebastiaan Wiersema 06/09/08, 11:53 updated 06/01/13, 14:45

Description

There is no check in class.tx_impexp.php to see if it is necessary to alter the memory_limit setting. Even when the value is altered in php.ini to a higher value (say, 512MB) this is set back to 256MB.

I bumped into this when exporting a huge site. I tried to alter the php.ini memory_limit setting up to 512MB, which didn’t have any effect. I still got a memory exceeded fatal error…

The following patch should do the trick:

—- typo3/sysext/impexp/class.tx_impexp.php 2007-12-14 15:08:55.000000000 +0100
+++ typo3/sysext/impexp/class.tx_impexp.php 2008-06-09 11:51:29.000000000 +0200
@@ -180,7 +180,10
require_once (PATH_t3lib.‘class.t3lib_refindex.php’);

ini_set('max_execution_time',600);
-
ini_set(‘memory_limit’,‘256m’);
+$memory_limit = ini_get(‘memory_limit’);
+if (strtolower(substr($memory_limit, -1)) == ‘m’ && substr($memory_limit, 0, -1) < 256) {
+ @ini_set(‘memory_limit’,‘256m’);
+}

(issue imported from #M8649)

Reviews 2