Projekt

Allgemein

Profil

GX-Bug #59836 » MemoryLimitGBFix1.patch

Till Tepelmann, 01.11.2018 15:52

Unterschiede anzeigen:

src/inc/set_memory_limit.inc.php (date 1541083882000)
18 18
	{
19 19
		$serverMemoryLimit = @ini_get('memory_limit');
20 20
		
21
		if(preg_match('/[\d]+M/', (string)$serverMemoryLimit))
21
		if(preg_match('/([\d]+)([MG]*)/', $serverMemoryLimit,$memoryLimit))
22 22
		{
23
			$memoryLimit = (int)substr($serverMemoryLimit, 0, -1);
23
			$memoryLimit = (int)$memoryLimit[1];
24
			if(isset($serverMemoryLimit[2]) && $serverMemoryLimit[2] === 'G')
25
			{
26
				$memoryLimit *= 1024;
27
			}
28
			elseif(isset($serverMemoryLimit[2]) && $serverMemoryLimit[2] !== 'M')
29
			{
30
				$memoryLimit *= 1024 * 1024;
31
			}
32
			
24 33
			if($memoryLimit < $limitInMegaBytes)
25 34
			{
26 35
				@ini_set('memory_limit', $minMemoryLimit);
......
34 43
				$minMemoryLimitGiven = true;
35 44
			}
36 45
		}
37
		elseif(preg_match('/^[\d]+$/', (string)$serverMemoryLimit))
38
		{
39
			$memoryLimit    = (int)$serverMemoryLimit;
40
			$minMemoryLimit = $limitInMegaBytes * 1024 * 1024;
41
			
42
			if($memoryLimit < $minMemoryLimit)
43
			{
44
				@ini_set('memory_limit', $minMemoryLimit);
45
				if(@ini_get('memory_limit') === $minMemoryLimit)
46
				{
47
					$minMemoryLimitGiven = true;
48
				}
49
			}
50
			else
51
			{
52
				$minMemoryLimitGiven = true;
53
			}
54
		}
46
	}
47
	else
48
	{
49
		$minMemoryLimitGiven = true;
55 50
	}
56 51
	
57 52
	return $minMemoryLimitGiven;
    (1-1/1)