Skip to content

Conversation

@opengeek
Copy link
Member

@opengeek opengeek commented Jan 30, 2026

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.

@opengeek opengeek requested a review from Mark-H as a code owner January 30, 2026 19:44
@opengeek opengeek changed the title Fix file size calculation in modTransportPackage Fix memory_limit calculation in modTransportPackage Jan 30, 2026
@opengeek opengeek requested a review from smg6511 January 30, 2026 19:53
@opengeek opengeek merged commit 33243da into modxcms:3.x Feb 3, 2026
5 of 6 checks passed
@opengeek opengeek deleted the 3.x-issue-16504-polyfill branch February 3, 2026 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Installing extras generates "filesize()" error messages

2 participants