When entity goes to validate / sanitize a body / longtext field it calls this function for output. The problem arrises when there is no text set in the text field / the field isn't set at all on the entity. This causes the field to throw property / array value not set notices all over the place. This becomes especially apparent when utilizing a project like restws which can make calls like /node.json to return all nodes in a site in json format. This call causes empty fields to be transmitted as output (and their output sanitized) where as a normal loading of the node via http call won't try and sanitize empty data.

Patch in bound, very simple to test for and resolve.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

btopro’s picture

Status: Active » Needs review
FileSize
1020 bytes

Patch

btopro’s picture

still applies cleanly w/ latest

MustangGB’s picture

Status: Needs review » Reviewed & tested by the community
fago’s picture

Status: Reviewed & tested by the community » Needs work

That seems to be reasonable, but I think this needs some test coverage and ideally some more testers (who actually report they tested it) also.

BR0kEN’s picture

Status: Needs work » Needs review
Related issues: +#2429129: Call entity with no "body", +#1172334: Error at indexing step
FileSize
1.87 KB

Personally I came from the #2429129: Call entity with no "body". I think we shouldn't assume that body field exists for every content type.

Chris Matthews’s picture

The patch in #5 to node.info.inc applied cleanly to the latest entity 7.x-1.x-dev, but still needs to be reviewed and tested.