Problem/Motivation

Steps to reproduce:
1. Create a translatable entity (node)
2. Create a job to translate the created entity
3. Delete the original entity
4. Go to job, translate the content, review the changes of a job item, click "Save"
5. You should get a fatal error: Fatal error: Call to a member function toString() on null (JobItemForm.php on line 349)

Proposed resolution

As JobItem::getSourceUrl() can return NULL, we should (at least) check if it is not null before calling other methods on it.

Comments

mbovan created an issue. See original summary.

mbovan’s picture

Status: Active » Needs review
StatusFileSize
new1.15 KB

Fix.

mbovan’s picture

Component: Core » User interface
berdir’s picture

do we need the same for the needs review message?

mbovan’s picture

In JobItem::needsReview() there is already a check for the source url.

Btw, first 4 steps apply for "Preview" as well - where we get an exception. Maybe we can fix it in this issue?
We could throw a 404 in case ContentTranslationPreviewController::preview() fails to load an entity...

berdir’s picture

Throwing a not found exception probably makes most sense for that.

berdir’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Which you already do. Changes look fine, lets make sure we have tests for it.

mbovan’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new3.7 KB
new1.39 KB

Added tests.

  • Berdir committed 942ffea on 8.x-1.x authored by mbovan
    Issue #2690037 by mbovan: Check if source url of a job item exists on...
berdir’s picture

Status: Needs review » Fixed

Works for me. The message is a bit strange when the source doesn't exist anymore, we should consider a more obvious warning/error. We have #1686544: Check for source change on review and show diff, please leave a comment there to care about this case too or open an issue for that.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.