Permalink
Browse files

Fixing handling of empty memory_limit for PHP without memory_limit (m…

…ostly Windows binaries)- fixed typo
  • Loading branch information...
1 parent 609cba7 commit 4b8980fc8375bb036f6a4654acabcd8efffbd927 martinlanghoff committed Nov 20, 2004
Showing with 12 additions and 2 deletions.
  1. +12 −2 lib/moodlelib.php
View
14 lib/moodlelib.php
@@ -3344,9 +3344,19 @@ function raise_memory_limit ($newlimit) {
return false;
}
- $cur = return_bytes(@ini_get('memory_limit'));
- $new = return_bytes($newlimit);
+ $cur = @ini_get('memory_limit');
+ if (empty($cur)) {
+ // if php is compiled without --enable-memory-limits
+ // apparently memory_limit is set to ''
+ $cur=0;
+ } else {
+ if ($cur == -1){
+ return true; // unlimited mem!
+ }
+ $cur = return_bytes($cur);
+ }
+ $new = return_bytes($newlimit);
if ($new > $cur) {
ini_set('memory_limit', $newlimit);
return true;

0 comments on commit 4b8980f

Please sign in to comment.