Language Change bug PR-5.0-dev Pending

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
28 Feb 2023

Pull Request for Issue #39717.

Summary of Changes

The indexer in Smart Search currently has situations where errors are returned and instead of gracefully reporting an error, the whole indexing just silently stops and does not proceed. This PR tries to catch all output and notices from finder plugins and return that as properly formatted error. I also removed some unused code.

Testing Instructions

  1. Go to a finder plugin, for example /plugins/finder/content/src/Extension/Content.php and trigger any output in the index() method. For example you can add var_dump($item->title).
  2. In the Smart Search component in the backend click on "Index".

Actual result BEFORE applying this Pull Request

The indexing starts, but shortly after it does not progress any further.

Expected result AFTER applying this Pull Request

The indexing starts and shortly after an error message is displayed. The whole response can be found in the browser console.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar joomla-cms-bot joomla-cms-bot - change - 28 Feb 2023
Category Administration com_finder Language & Strings
avatar Hackwar Hackwar - open - 28 Feb 2023
avatar Hackwar Hackwar - change - 28 Feb 2023
Status New Pending
avatar Fedik Fedik - test_item - 28 Feb 2023 - Tested successfully
avatar Fedik
Fedik - comment - 28 Feb 2023

I have tested this item successfully on 8b37e66


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

avatar Hackwar Hackwar - change - 28 Feb 2023
Labels Added: Language Change PR-4.3-dev
avatar wilsonge
wilsonge - comment - 1 Mar 2023

OK this just hides the message and doesn't give us any way to actually fix the problem? Like if there are PHP errors - yes we don't want things to silently fail - but we do want to make sure that they are logged so we can fix them properly in the future rather than just silently swallowing them.

avatar Fedik
Fedik - comment - 1 Mar 2023

I think George is right.
It probably can be improved in clinet side

onSuccess: (response) => {
handleResponse(JSON.parse(response));
},
onError: (xhr) => {
handleFailure(xhr);
},

Need kind of

let response;
try {
  response = JSON.parse(data);
} catch (e) {
  Joomla.renderMessages(Joomla.ajaxErrorsMessages(xhr, 'parsererror'));
}
handleResponse(response); 

Need to test

avatar Hackwar
Hackwar - comment - 1 Mar 2023

I tried the try-catch and had all of that ready, but it made everything a lot uglier. The thing is that you need to have access to the output and that is now properly in the browser console.

I've used this approach because we have most of the necessary code already in there. We have ob_start() everywhere, but we are missing actually suppressing the output.

avatar Fedik
Fedik - comment - 1 Mar 2023

I will prepare another pr, need some time

avatar Fedik
Fedik - comment - 1 Mar 2023

There it is #39973, please review ?

avatar chmst
chmst - comment - 4 Mar 2023

@Hackwar as #39973 is RTC, could you close this one?

avatar Hackwar
Hackwar - comment - 4 Mar 2023

They are both valid from my perspective.

avatar Hackwar Hackwar - change - 18 Apr 2023
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2023-04-18 12:06:39
Closed_By Hackwar
Labels Added: bug
avatar Hackwar Hackwar - close - 18 Apr 2023
avatar Hackwar Hackwar - change - 18 Apr 2023
Status Closed New
Closed_Date 2023-04-18 12:06:39
Closed_By Hackwar
avatar Hackwar Hackwar - change - 18 Apr 2023
Status New Pending
avatar Hackwar Hackwar - reopen - 18 Apr 2023
avatar Hackwar Hackwar - change - 18 Apr 2023
Title
[4.3] Improving error handling of Smart Search Indexing
[5.0] Improving error handling of Smart Search Indexing
avatar Hackwar Hackwar - edited - 18 Apr 2023
avatar Hackwar Hackwar - change - 18 Apr 2023
Title
[5.0] Improving error handling of Smart Search Indexing
[5.0] Smart Search: Improving error handling of Indexing
avatar Hackwar Hackwar - edited - 18 Apr 2023
avatar Hackwar Hackwar - change - 27 Apr 2023
Labels Added: PR-5.0-dev
Removed: PR-4.3-dev
avatar HLeithner
HLeithner - comment - 29 May 2023

this can be closed since #39973 has been merged right? @Hackwar

avatar Hackwar
Hackwar - comment - 30 May 2023

No, I'd like to have both merged, since this one here fixes issues on the PHP side, while #39973 fixes this on JS side of things.

avatar HLeithner HLeithner - change - 30 May 2023
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-05-30 11:36:19
Closed_By HLeithner
avatar HLeithner HLeithner - close - 30 May 2023
avatar HLeithner HLeithner - merge - 30 May 2023
avatar HLeithner
HLeithner - comment - 30 May 2023

thanks

Add a Comment

Login with GitHub to post a comment