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

Handle DB errors in categories search plugin #7073

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions administrator/language/en-GB/en-GB.lib_joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ JLIB_DATABASE_ERROR_VALID_AZ09="Please enter a valid username. No space at begin
JLIB_DATABASE_ERROR_VALID_MAIL="Please enter a valid email address."
JLIB_DATABASE_ERROR_VIEWLEVEL="Viewlevel must have a title."
JLIB_DATABASE_FUNCTION_NOERROR="DB function reports no errors."
JLIB_DATABASE_GENERIC_SQL_ERROR="There has been an error."
JLIB_DATABASE_QUERY_FAILED="Database query failed (error # %s): %s"

JLIB_DOCUMENT_ERROR_UNABLE_LOAD_DOC_CLASS="Unable to load document class."
Expand Down
1 change: 1 addition & 0 deletions language/en-GB/en-GB.ini
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ JLIB_DATABASE_ERROR_CONNECT_DATABASE="Unable to connect to the Database: %s"
JLIB_DATABASE_ERROR_CONNECT_MYSQL="Could not connect to MySQL."
JLIB_DATABASE_ERROR_DATABASE_CONNECT="Could not connect to database"
JLIB_DATABASE_ERROR_LOAD_DATABASE_DRIVER="Unable to load Database Driver: %s"
JLIB_DATABASE_GENERIC_SQL_ERROR="There has been an error."
JLIB_ERROR_INFINITE_LOOP="Infinite loop detected in JError"

JOPTION_SELECT_ACCESS="- Select Access -"
Expand Down
1 change: 1 addition & 0 deletions language/en-GB/en-GB.lib_joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ JLIB_DATABASE_ERROR_VALID_AZ09="Please enter a valid username. No space at begin
JLIB_DATABASE_ERROR_VALID_MAIL="Please enter a valid email address."
JLIB_DATABASE_ERROR_VIEWLEVEL="Viewlevel must have a title."
JLIB_DATABASE_FUNCTION_NOERROR="DB function reports no errors."
JLIB_DATABASE_GENERIC_SQL_ERROR="There has been an error."
JLIB_DATABASE_QUERY_FAILED="Database query failed (error # %s): %s"

JLIB_DOCUMENT_ERROR_UNABLE_LOAD_DOC_CLASS="Unable to load document class."
Expand Down
11 changes: 10 additions & 1 deletion plugins/search/categories/categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,16 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu
}

$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
try
{
$rows = $db->loadObjectList();
}
catch (RuntimeException $e)
{
$rows = array();
JFactory::getApplication()->enqueueMessage(JText::_('JLIB_DATABASE_GENERIC_SQL_ERROR'), 'error');
JLog::add($e->getMessage(), JLog::ERROR, 'controller');
}

$return = array();

Expand Down