Commit 33243da
authored
Fix memory_limit calculation in modTransportPackage (#16820)
### What does it do?
Re-implements the `_bytes` method using `ini_parse_quantity` introduced
in PHP 8.2, providing a polyfill for use in PHP 8.1.
### Why is it needed?
A php warning occurs (and gets logged in MODX as an error) because the
`_bytes` function attempts to use the ini `memory_limit` value in a
calculation without removing the modifier string (_e.g._, 128M *= 1024).
This triggers the “A non-numeric value encountered” warning.
### How to test
1. Download any package before applying this PR fix. Note the warning in
your MODX error log
2. Apply this PR and verify the warning no longer appears and that
package downloads work as expected
### Related issue(s)/PR(s)
Resolves #16504. Alternate solution for #16797 that supports all valid
quantities that might appear in the ini `memory_limit` value.1 parent af7a969 commit 33243da
File tree
2 files changed
+3
-15
lines changed- core/src/Revolution/Transport
2 files changed
+3
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
746 | 746 | | |
747 | 747 | | |
748 | 748 | | |
749 | | - | |
750 | | - | |
751 | | - | |
752 | | - | |
753 | | - | |
754 | | - | |
755 | | - | |
756 | | - | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
| 749 | + | |
763 | 750 | | |
764 | 751 | | |
765 | 752 | | |
| |||
0 commit comments