From 4dea3ece8a68d55dd1764529e185c55c56476f5b Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Wed, 14 Jun 2017 18:16:39 +0100 Subject: [PATCH] Fix memory limit detection on some systems --- includes/import/abstract-wc-product-importer.php | 4 +++- includes/libraries/wp-background-process.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/import/abstract-wc-product-importer.php b/includes/import/abstract-wc-product-importer.php index 84df5bda2c1..1a0b575d52b 100644 --- a/includes/import/abstract-wc-product-importer.php +++ b/includes/import/abstract-wc-product-importer.php @@ -658,12 +658,14 @@ abstract class WC_Product_Importer implements WC_Importer_Interface { // Sensible default. $memory_limit = '128M'; } - if ( ! $memory_limit || -1 === $memory_limit ) { + + if ( ! $memory_limit || -1 === intval( $memory_limit ) ) { // Unlimited, set to 32GB. $memory_limit = '32000M'; } return intval( $memory_limit ) * 1024 * 1024; } + /** * Time exceeded. * diff --git a/includes/libraries/wp-background-process.php b/includes/libraries/wp-background-process.php index 7756c278136..b29738edd12 100644 --- a/includes/libraries/wp-background-process.php +++ b/includes/libraries/wp-background-process.php @@ -362,7 +362,7 @@ abstract class WP_Background_Process extends WP_Async_Request { $memory_limit = '128M'; } - if ( ! $memory_limit || -1 === $memory_limit ) { + if ( ! $memory_limit || -1 === intval( $memory_limit ) ) { // Unlimited, set to 32GB. $memory_limit = '32000M'; }