Skip to content

Commit

Permalink
Fixed #25450915: Alert disable memory_limit
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelpichler committed Feb 25, 2012
1 parent 9cb63ec commit 0628e7d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup
13 changes: 12 additions & 1 deletion src/bin/pdepend.php
Expand Up @@ -54,7 +54,18 @@
require_once 'PHP/Depend/Autoload.php';

// Allow as much memory as possible by default
ini_set('memory_limit', -1);
if (extension_loaded('suhosin')) {
$limit = ini_get('memory_limit');
if (preg_match('(^(\d+)([BKMGT]))', $limit, $match)) {
$shift = array('B' => 0, 'K' => 10, 'M' => 20, 'G' => 30, 'T' => 40);
$limit = ($match[1] * (1 << $shift[$match[2]]));
}
if (ini_get('suhosin.memory_limit') > $limit) {
ini_set('memory_limit', ini_get('suhosin.memory_limit'));
}
} else {
ini_set('memory_limit', -1);
}

// Disable E_STRICT for all PHP versions < 5.3.x
if (version_compare(phpversion(), '5.3.0')) {
Expand Down
10 changes: 10 additions & 0 deletions src/site/docx/changes.xml
Expand Up @@ -9,6 +9,16 @@
</properties>

<body>
<release version="1.0.3"
date="2012/02/25"
description="This release closes a minor issue in PHP_Depend's
memory handling when it is run in a PHP environment
that uses the Suhosin patch and the suhosin.memory_limit
setting.">
<action date="" dev="mapi" issue="25450915" system="pivotaltracker" type="fix" due-to="Gordon Franke">
Alert disable memory_limit
</action>
</release>
<release version="1.0.2"
date="2012/02/15"
description="This release contains a huge improvement in PHP_Depend's
Expand Down

0 comments on commit 0628e7d

Please sign in to comment.