Skip to content

[5.4] Use the correct function to get the message from an exception#47972

Open
laoneo wants to merge 1 commit into
joomla:5.4-devfrom
Digital-Peak:exception/message
Open

[5.4] Use the correct function to get the message from an exception#47972
laoneo wants to merge 1 commit into
joomla:5.4-devfrom
Digital-Peak:exception/message

Conversation

@laoneo

@laoneo laoneo commented Jun 17, 2026

Copy link
Copy Markdown
Member
  • 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

The exception object doesn't have an errorMessage function, getMessage should be used instead.

Testing Instructions

  • Disable mail in the global Joomla configuration
  • In the file /administrator/components/com_users/src/Model/MailModel.php add after line 203 the code throw new RuntimeException('test');
  • Send a mass mail to the users

Actual result BEFORE applying this Pull Request

The following error is shown:
Call to undefined method RuntimeException::errorMessage()

Expected result AFTER applying this Pull Request

A warning message appears with text 'test'.

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

@richard67 richard67 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is correct according to https://www.php.net/manual/en/class.exception.php .

There is no errorMessage() for the exception object, there is getMessage().

@MacJoom

MacJoom commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on 1588657

But you have to add (for testing, before and after applying the patch)

throw new \RuntimeException('test'); //after line 203

Note the backslash before \RuntimeException


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

@CSGoat0

CSGoat0 commented Jun 19, 2026

Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on 1588657

Thanks @MacJoom for the correction.


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

@richard67

Copy link
Copy Markdown
Member

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jun 19, 2026
@richard67 richard67 added this to the Joomla! 5.4.7 milestone Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug PR-5.4-dev RTC This Pull Request is Ready To Commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants