Skip to content

Conversation

@ilyautkin
Copy link
Contributor

What does it do?

Fixes modMediaSource::getSkipExtensionsArray() so it returns the already-parsed $skipExtensions array directly instead of calling explode() a second time. Since $skipExtensions is already converted to an array earlier in the method, re-exploding it is redundant and can cause runtime errors.

Why is it needed?

Calling explode(',', $skipExtensions) after $skipExtensions has already been converted to an array can lead to a runtime error, especially on PHP 8+, where explode() requires a string. This change ensures the method consistently returns an array of extensions and avoids PHP errors.

How to test

  1. In the Manager, create or edit a Media Source that uses modMediaSource (or a derivative).
  2. Set the skipExtensions property to a comma-separated list (e.g. zip,rar,psd).
  3. Open the Media Browser or perform any action that relies on this property.
  4. Verify that:
    • No PHP error related to explode() occurs.
    • The skip extensions are applied correctly.

Related issue(s)/PR(s)

  • None yet.

@opengeek opengeek added this to the v3.2.0 milestone Dec 30, 2025
@opengeek opengeek added the bug The issue in the code or project, which should be addressed. label Dec 30, 2025
@opengeek opengeek merged commit ea5fc07 into modxcms:3.x Dec 30, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug The issue in the code or project, which should be addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants