Error: Call to a member function asXML() on bool, U+0008 character

Created on 4 February 2025, about 14 hours ago

Problem/Motivation

The tmgmt module fails when trying to create a job item in which a field contains the "Backspace" character (U+0008).
This character appears invisible, but is navigable via keyboard.

More info on the character in question:

We have a multilingual site and this backspace character snuck it's way in somehow during content entry for a Korean language article. Sometimes when typing English characters or punctuation, using a Korean (or other East Asian language) keyboard, characters not typical to a US keyboard.

Here is the character (x5) : >>> <<<<< Use your keyboard and go from the first set of brackets to the next and you'll understand how it's invisible but navigable via keyboard.

During the XML creation process, this character results in creation of invalid code and causes a critical error.

Steps to reproduce

  1. Create a piece of content, include the backspace character in a field that includes text strings. In my case, it was a CKEditor WYSIWYG field.
  2. Try to translate the content via the tmgmt module. The job should fail once you click "Submit to provider"

Stacktrace:

Error: Call to a member function asXML() on bool in Drupal\globallink\Plugin\tmgmt\Translator\GlobalLinkTranslator->getXliffData() (line 824 of modules/contrib/globallink/src/Plugin/tmgmt/Translator/GlobalLinkTranslator.php).
Drupal\globallink\Plugin\tmgmt\Translator\GlobalLinkTranslator->doRequestTranslations(Array, Object) (Line: 831)
Drupal\globallink\Plugin\tmgmt\Translator\GlobalLinkTranslator->requestJobItemsTranslation(Array, Object) (Line: 526)
Drupal\globallink\Plugin\tmgmt\Translator\GlobalLinkTranslator->requestTranslation(Object) (Line: 753)
Drupal\tmgmt\Entity\Job->requestTranslation() (Line: 331)
Drupal\tmgmt\JobCheckoutManager->requestTranslation(Object) (Line: 704)
Drupal\tmgmt\Form\JobForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 129)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 67)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
Drupal\Core\Form\FormBuilder->processForm('tmgmt_job_edit_form', Array, Object) (Line: 326)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
...
Notes for troubleshooting:

In <code>tmgmt/translators/tmgmt_file/src/Plugin/tmgmt_file/Format/Xliff.php

a call is made to addItem() at line 232, addItem() calls <code>filterTranslatable() which takes the argument $item->getData() (the "data" includes the field values with string that contains bad character).

filterTranslatable is in web/modules/contrib/tmgmt/src/Data.php

I couldn't find an existing/active issue for this, I also wasn't sure if this is something that should be accounted for in the string parsing that happens in the addItem function.

πŸ› Bug report
Status

Active

Version

1.16

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States uri_frazier Portland, Oregon

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024