No Code Attached Yet
avatar brianteeman
brianteeman
25 Mar 2025

Do something that will create a private message and then try to open that message


An error has occurred.
0 Call to undefined method stdClass::set()
Call Stack
#	Function	Location
1	()	JROOT\administrator\components\com_messages\src\Model\MessageModel.php:191
2	Joomla\Component\Messages\Administrator\Model\MessageModel->getItem()	JROOT\administrator\components\com_messages\src\Model\MessageModel.php:233
3	Joomla\Component\Messages\Administrator\Model\MessageModel->loadFormData()	JROOT\libraries\src\MVC\Model\FormBehaviorTrait.php:108
4	Joomla\CMS\MVC\Model\FormModel->loadForm()	JROOT\administrator\components\com_messages\src\Model\MessageModel.php:211
5	Joomla\Component\Messages\Administrator\Model\MessageModel->getForm()	JROOT\administrator\components\com_messages\src\View\Message\HtmlView.php:70
6	Joomla\Component\Messages\Administrator\View\Message\HtmlView->display()	JROOT\libraries\src\MVC\Controller\BaseController.php:697
7	Joomla\CMS\MVC\Controller\BaseController->display()	JROOT\administrator\components\com_messages\src\Controller\DisplayController.php:65
8	Joomla\Component\Messages\Administrator\Controller\DisplayController->display()	JROOT\libraries\src\MVC\Controller\BaseController.php:730
9	Joomla\CMS\MVC\Controller\BaseController->execute()	JROOT\libraries\src\Dispatcher\ComponentDispatcher.php:143
10	Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch()	JROOT\libraries\src\Component\ComponentHelper.php:361
11	Joomla\CMS\Component\ComponentHelper::renderComponent()	JROOT\libraries\src\Application\AdministratorApplication.php:150
12	Joomla\CMS\Application\AdministratorApplication->dispatch()	JROOT\libraries\src\Application\AdministratorApplication.php:205
13	Joomla\CMS\Application\AdministratorApplication->doExecute()	JROOT\libraries\src\Application\CMSApplication.php:304
14	Joomla\CMS\Application\CMSApplication->execute()	JROOT\administrator\includes\app.php:58
15	require_once()	JROOT\administrator\index.php:32
avatar brianteeman brianteeman - open - 25 Mar 2025
avatar joomla-cms-bot joomla-cms-bot - change - 25 Mar 2025
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 25 Mar 2025
avatar hiteshm0
hiteshm0 - comment - 25 Mar 2025

Could converting the stdClass object to a registry object be a potential fix ?

avatar joomdonation
joomdonation - comment - 25 Mar 2025

No, it is simpler than that. Just assign the value to property directly instead of using set method. So, change code from:

$this->item->set('user_id_to', $message->user_id_from);

To:

$this->item->user_id_to = $message->user_id_from;

There are 3 lines of code need to be changed in getItem method of MessageModel

avatar hiteshm0
hiteshm0 - comment - 25 Mar 2025

@joomdonation can i implement this change and pull a PR ? [ The 3 lines needing the change being 167, 171, 192 ]

avatar joomdonation joomdonation - change - 25 Mar 2025
Status New Closed
Closed_Date 0000-00-00 00:00:00 2025-03-25 12:03:32
Closed_By joomdonation
avatar joomdonation joomdonation - close - 25 Mar 2025
avatar joomdonation
joomdonation - comment - 25 Mar 2025

@hiteshm0 So there are changes in different places needed and you might get some difficulty with testing instructions, so I decided to go ahead to make PR, sorry. The PR #45213 should fix the this issue, please test. Thanks !

avatar hiteshm0
hiteshm0 - comment - 25 Mar 2025

@joomdonation hello, you don't have to apologise , i am only a student and was thinking if it would be more convenient for you if i pulled the PR. Hopefully im not being a pest.

avatar joomdonation
joomdonation - comment - 25 Mar 2025

@hiteshm0 Yes, I know and actually I wanted you to make the PR, that was the reason I described the solution. But I then realized that testing instructions could be difficult for you - who is still new with Joomla (because we need to have private message added for the account to see the error) - that was the reason I made the PR myself. Hope to see your PR for other issue/feature in near future.

avatar hiteshm0
hiteshm0 - comment - 27 Mar 2025

@joomdonation sorry i missed your message , and thank you for the words of encouragement 👍

Add a Comment

Login with GitHub to post a comment