Fix bug parsing memory_limit in product importer (#46051)

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 538403306c (#30908)

Commit 4557108805 (#21557)
This commit is contained in:
siliconforks 2024-04-05 12:11:38 -03:00 committed by GitHub
parent b5b96bed04
commit 0d368bfc53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix bug parsing memory_limit in product importer

View File

@ -747,7 +747,7 @@ abstract class WC_Product_Importer implements WC_Importer_Interface {
// Unlimited, set to 32GB.
$memory_limit = '32000M';
}
return intval( $memory_limit ) * 1024 * 1024;
return wp_convert_hr_to_bytes( $memory_limit );
}
/**