[TYPO3-core] RFC #8649: Bug: No check on memory_limit in class.tx_impexp.php

Michael Stucki michael at typo3.org
Sat Jul 12 00:41:23 CEST 2008


Dmitry Dulepov [typo3] wrote:

>> 1. Check memory_limit and max_execution_time
>> 2. If they are too low, keep on using the currently hardcoded value
> 
> I do not think this is a right thing. There should be no hard-coded value
> because we provide configuration value, which is the absolute maximum set
> by admin in Install tool. Code should not set value higher because it may
> impact the server. Admin knows what he does when sets memory_limit. He
> would not want TYPO3 to use more.

Which admin wants to block users from using a feature which the user has
permission to use? If the memory limit is 32 MB (that is sufficient in many
cases) we still know that impexp usually needs more - a lot more - memory.

After reading through the whole thread again, I actually found out that this
is exactly what Sebastian originally proposed... :-)

However, since I don't like the way how the shorthand is parsed, I've made
an alternative solution:

function unit_to_number($value) {
        $c = 0;
        if (strcmp($value,intval($value))) {
                $value = preg_replace('/[B ]/', '', $value);

                $units = array('B','K','M','G','T');
                foreach ($units as $c => $unit) {
                        if (stristr($value,$unit)) {
                                $value = str_ireplace($unit, '', $value);
                                break;
                        }
                }
        }
        $value = intval($value) * pow(1024,$c);

        return $value;
}

(Should probably go into t3lib_div...)

- michael
-- 
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/


More information about the TYPO3-team-core mailing list