RTC bug PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar Bakual
Bakual
31 Aug 2026

The return value is supposed to be a boolean. preg_match however returns 0, 1 or false. Casting to boolean enforces the correct return value.

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

Cast the return value of MediaHelper->isImage to boolean as expected by the function documentation.
The return value is used in the getMineType function as second argument and is also expected to be boolean there. In that method, it also is explicitely checked if "true", which it currently never is (remember, preg_match never returns "true").

Testing Instructions

Uploading an image in the media manager should work the same, before and after that change.
I only noticed this, when I tried to implement the helper with my own extension and it had issues detecting the mime of an image.

Actual result BEFORE applying this Pull Request

Upload works

Expected result AFTER applying this Pull Request

Upload works

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar Bakual Bakual - open - 31 Aug 2026
avatar Bakual Bakual - change - 31 Aug 2026
Status New ⇒ Pending
avatar joomla-cms-bot joomla-cms-bot - change - 31 Aug 2026
Category ⇒ Libraries
avatar richard67 richard67 - change - 31 Aug 2026
Title
…
Cast preg_match result to boolean in isImage method
[5.4] Cast preg_match result to boolean in isImage method
avatar richard67 richard67 - edited - 31 Aug 2026
avatar QuyTon QuyTon - test_item - 1 Sep 2026 - Tested successfully
avatar QuyTon
QuyTon - comment - 1 Sep 2026

I have tested this item ✅ successfully on ac6e03e


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48347.

avatar QuyTon
QuyTon - comment - 1 Sep 2026

I have tested this item ✅ successfully on ac6e03e


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48347.

avatar alikon alikon - test_item - 1 Sep 2026 - Tested successfully
avatar alikon
alikon - comment - 1 Sep 2026

I have tested this item ✅ successfully on ac6e03e


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48347.

avatar alikon
alikon - comment - 1 Sep 2026

I have tested this item ✅ successfully on ac6e03e


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48347.

avatar alikon alikon - change - 1 Sep 2026
Status Pending ⇒ Ready to Commit
avatar alikon
alikon - comment - 1 Sep 2026

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48347.

avatar alikon
alikon - comment - 1 Sep 2026

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48347.

avatar muhme muhme - change - 4 Sep 2026
Labels Added: RTC PR-5.4-dev
avatar muhme
muhme - comment - 4 Sep 2026

✅ Final test before merge

  • Image upload in media manager is working before and after applying this PR with Patch Tester with upload button or by drag&drop
  • No unusual Joomla or PHP log entries
avatar muhme muhme - change - 4 Sep 2026
Status Ready to Commit ⇒ Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 ⇒ 2026-09-04 14:27:24
Closed_By ⇒ muhme
Labels Added: bug
avatar muhme muhme - close - 4 Sep 2026
avatar muhme muhme - merge - 4 Sep 2026
avatar muhme
muhme - comment - 4 Sep 2026

Thank you very much @Bakual for your contribution. Thanks to @QuyTon and @alikon for testing.

Add a Comment

Login with GitHub to post a comment