Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] getMessage doesn't exist, use getError instead. #6783

Closed
wants to merge 3 commits into from

Conversation

Bakual
Copy link
Contributor

@Bakual Bakual commented Apr 15, 2015

Issue

When the menu rebuild fails, a fatal error occurs since the model doesn't support a getMessage method. Also the language string it tries to use, doesn't exist.

Solution

Use getError instead of getMessage and add the language string.

Testing

To reproduce the issue you need to get the rebuild to fail. For that you can go to the #__menu table and delete the first row (id 1, root). That will break the nested set for sure.

See that you get a fatal error.
After applying the PR, you will get an error show that the rebuild failed with a lengthy exception message,

@sovainfo
Copy link
Contributor

Error

Rebuild failed: exception 'UnexpectedValueException' with message 'MenusTableMenu::getRootId' in
C:\xampp\htdocs\J3x\J34\j341\libraries\joomla\table\nested.php:1270
Stack trace:
#0 C:\xampp\htdocs\J3x\J34\j341\libraries\joomla\table\nested.php(1297): JTableNested->getRootId()
#1 C:\xampp\htdocs\J3x\J34\j341\administrator\components\com_menus\models\item.php(1108): JTableNested->rebuild()
#2 C:\xampp\htdocs\J3x\J34\j341\administrator\components\com_menus\controllers\menus.php(108): MenusModelItem->rebuild()
#3 C:\xampp\htdocs\J3x\J34\j341\libraries\legacy\controller\legacy.php(728): MenusControllerMenus->rebuild()
#4 C:\xampp\htdocs\J3x\J34\j341\administrator\components\com_menus\menus.php(18): JControllerLegacy->execute('rebuild')
#5 C:\xampp\htdocs\J3x\J34\j341\libraries\cms\component\helper.php(391): require_once('C:\xampp\htdocs...')
#6 C:\xampp\htdocs\J3x\J34\j341\libraries\cms\component\helper.php(371): JComponentHelper::executeComponent('C:\xampp\htdocs...')
#7 C:\xampp\htdocs\J3x\J34\j341\libraries\cms\application\administrator.php(98): JComponentHelper::renderComponent('com_menus')
#8 C:\xampp\htdocs\J3x\J34\j341\libraries\cms\application\administrator.php(152): JApplicationAdministrator->dispatch()
#9 C:\xampp\htdocs\J3x\J34\j341\libraries\cms\application\cms.php(252): JApplicationAdministrator->doExecute()
#10 C:\xampp\htdocs\J3x\J34\j341\administrator\index.php(42): JApplicationCms->execute()
#11 {main}

Expected:
Error

Rebuild failed due to database error.


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

@Bakual
Copy link
Contributor Author

Bakual commented Apr 15, 2015

We can change the message to something more general and remove the sprintf / getError stuff completely.
I just don't know if there are more than one way to break the rebuild.

@wilsonge
Copy link
Contributor

See Bakual#3

Wrap table rebuild method in a try/catch statement
@Kubik-Rubik Kubik-Rubik added this to the Joomla! 3.4.4 milestone Jul 9, 2015
@Kubik-Rubik Kubik-Rubik added the RTC This Pull Request is Ready To Commit label Jul 9, 2015
@Kubik-Rubik
Copy link
Member

Thank you @Bakual! Merged.

@Bakual Bakual closed this in 307df51 Jul 9, 2015
@Bakual Bakual deleted the FixGetMessage branch July 9, 2015 20:35
@zero-24 zero-24 removed the RTC This Pull Request is Ready To Commit label Oct 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Language Change This is for Translators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants