When saving programmatically an entity that does not have a "format" property for "body" or "description" field, the title_field_text_with_summary_sync_set() function throws a PHP notice.

To reproduce such bug, just create a dummy term in a vocabulary that have the "description" field replaced by a standard field. The term should only have a name and the related category keys (vid and vocabulary_machine_name) and may have a description set to NULL for example.
When saving programmatically the term, the bug occurs.

You may use for dummy creation the entity_create() function from Entity API module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

B-Prod’s picture

For info, the described bug is quite similar than the one in #1219860: Undefined index "format", that occurs in another function.

The patch below fixes that.

plach’s picture

Status: Needs review » Fixed

Committed and pushed, thanks!

Status: Fixed » Closed (fixed)

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

makokis’s picture

Issue summary: View changes
FileSize
86.68 KB

I get this error using last Commerce Kickstart profile version 2.14:
Notice: Undefined property: stdClass::$format en title_field_text_with_summary_sync_set() (línea 167 de ../profiles/commerce_kickstart/modules/contrib/title/title.core.inc).

when triying to edit an existing Newsletter but it appears without changes made on it... (here is a screenshot)

do you recommend apply this patch?, it's older than one year

thanks

  • Commit 24d410d on 7.x-1.x, workbench authored by B-Prod, committed by plach:
    Issue #1850866 by B-Prod: Fixed Undefined index 'format' in...
leymannx’s picture

4 years later, patch still working. Hope it gets merged soon. Had this issue when creating terms with description_field programmatically.