From d4f0c8604a9c5dbe5267ed0a88374b42bcbc9e94 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 3 Oct 2013 03:27:04 +0000 Subject: [PATCH] Don't override a PHP memory_limit specified using G shorthand. props peterjaap. fixes #23251. git-svn-id: https://develop.svn.wordpress.org/trunk@25684 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/default-constants.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/default-constants.php b/src/wp-includes/default-constants.php index 358c1018f3..34750057be 100644 --- a/src/wp-includes/default-constants.php +++ b/src/wp-includes/default-constants.php @@ -41,7 +41,11 @@ function wp_initial_constants() { // set memory limits. if ( function_exists( 'memory_get_usage' ) ) { $current_limit = @ini_get( 'memory_limit' ); - if ( -1 != $current_limit && ( -1 == WP_MEMORY_LIMIT || ( intval( $current_limit ) < abs( intval( WP_MEMORY_LIMIT ) ) ) ) ) + $current_limit_int = intval( $current_limit ); + if ( false !== stripos( $current_limit, 'G' ) ) + $current_limit_int *= 1024; + + if ( -1 != $current_limit && ( -1 == WP_MEMORY_LIMIT || ( $current_limit_int < abs( intval( WP_MEMORY_LIMIT ) ) ) ) ) @ini_set( 'memory_limit', WP_MEMORY_LIMIT ); }