Skip to content

Commit

Permalink
Fix bug parsing memory_limit in product importer (woocommerce#46051)
Browse files Browse the repository at this point in the history
Previously, the code assumed that all memory_limit values used the "M"
suffix (for megabytes); values using "G" (for gigabytes), "K" (for
kilobytes), or no suffix (for bytes) were all parsed incorrectly.  Now,
all possible values should be handled correctly.

This bug has actually been fixed twice before in other locations:

Commit 5384033 (woocommerce#30908)

Commit 4557108 (woocommerce#21557)
  • Loading branch information
siliconforks authored Apr 5, 2024
1 parent b5b96be commit 0d368bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions plugins/woocommerce/changelog/do-not-assume-megabytes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix bug parsing memory_limit in product importer
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ protected function get_memory_limit() {
// Unlimited, set to 32GB.
$memory_limit = '32000M';
}
return intval( $memory_limit ) * 1024 * 1024;
return wp_convert_hr_to_bytes( $memory_limit );
}

/**
Expand Down

0 comments on commit 0d368bf

Please sign in to comment.