[TYPO3-dev] class.tx_impexp.php sets 256m memory_limit without checking php.ini

Sebastiaan Wiersema sebastiaan at buyways.nl
Tue Jun 10 11:43:39 CEST 2008


Hi,

Yesterday I reported the following bug in class.tx_impexp.php:
http://bugs.typo3.org/view.php?id=8649

On request of Benjamin Mack I'm sending the patch to this list.

Cheers,
Sebastiaan

--

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);
- at 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');
+}







More information about the TYPO3-dev mailing list