Permalink
Browse files

Fixed #25450811: Alert disable memory_limit

  • Loading branch information...
manuelpichler committed Feb 25, 2012
1 parent 194dfce commit 19e4fc53d6075122b14f06ebd588938341e72543
Showing with 28 additions and 6 deletions.
  1. +1 −1 lib/pdepend
  2. +1 −1 setup
  3. +13 −2 src/bin/phpmd.php
  4. +1 −1 src/conf/package.xml
  5. +12 −1 src/site/docx/changes.xml
View
@@ -12,8 +12,19 @@
);
}
-// Disable memory_limit
-ini_set('memory_limit', -1);
+// Allow as much memory as possible by default
+if (extension_loaded('suhosin') && is_numeric(ini_get('suhosin.memory_limit'))) {
+ $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);
+}
// Check php setup for cli arguments
if (!isset($_SERVER['argv']) && !isset($argv)) {
View
@@ -348,7 +348,7 @@
<package>
<name>PHP_Depend</name>
<channel>pear.pdepend.org</channel>
- <min>1.0.2</min>
+ <min>1.0.3</min>
</package>
<extension>
<name>pcre</name>
View
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document xmlns="http://maven.apache.org/changes/1.0.0"
+<document
+ xmlns="http://maven.apache.org/changes/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
@@ -9,6 +10,16 @@
</properties>
<body>
+ <release version="1.3.2"
+ date="2012/02/25"
+ description="This release closes a minor issue in PHP_PMD'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="25450811" system="pivotaltracker" type="fix" due-to="Gordon Franke">
+ Alert disable memory_limit
+ </action>
+ </release>
<release version="1.3.1"
date="2012/02/16"
description="The 1.3.1 release of PHPMD closes one critical bug

0 comments on commit 19e4fc5

Please sign in to comment.