Ticket #14889: 14889.patch

File 14889.patch, 1.1 KB (added by hakre, 3 years ago)
  • wp-includes/default-constants.php

     
    3535                $blog_id = 1; 
    3636 
    3737        // set memory limits. 
    38         if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) ) 
    39                 @ini_set('memory_limit', WP_MEMORY_LIMIT); 
     38        if ( 
     39                function_exists( 'memory_get_usage' ) 
     40                && ( $normalize_mem = create_function( '$val', '$val = trim($val); $last = strtolower($val[strlen($val)-1]); switch($last) { case \'g\': $val *= 1024; case \'m\': $val *= 1024; case \'k\': $val *= 1024; return max(0, (int) $val);' ) ) 
     41                && ( $normalize_mem( @ini_get( 'memory_limit' ) ) < $normalize_mem( WP_MEMORY_LIMIT ) ) 
     42                ) { 
     43                        @ini_set('memory_limit', WP_MEMORY_LIMIT); 
     44                } 
     45                 
     46        } 
     47        $normalize_mem = null; 
    4048 
    4149        if ( !defined('WP_CONTENT_DIR') ) 
    4250                define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down