After replacing a title, editing it to allow for filtered text and unlimited titles, and then unhiding in the Display tab, I got the following notice when viewing the node:

Notice: Undefined index: safe_value in title_field_formatter_view() (line 100 of /usr/share/drupal-RO/sites/all/modules/title/title.field.inc).

The notice does not go away. Running Drupal 7.22.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rei’s picture

I got the same error message
activating aggregation=yes in views, trigger the error message.

justindodge’s picture

Issue summary: View changes

Line 100 of title.field.inc inside of function title_field_formatter_view() has:
$output = isset($items[0]) ? $items[0]['safe_value'] : '';
which looks like it needs to change the key of 'safe_value' to 'value':
$output = isset($items[0]) ? $items[0]['value'] : '';

creatile’s picture

I also have the same message. It appears sometime after editing a page.
I am using drupal 7.24 and the following contrib modules :
Media 2x
ck editor link
ck editor link file
entity translation

cs_shadow’s picture

Status: Active » Needs review
FileSize
542 bytes

As suggested by justindodge, replacing 'safe_value' by 'value' fixes this issue. It seems that the 'safe_value' index was not defined. Attached is a patch for the same.

Status: Needs review » Needs work

The last submitted patch, 4: undefined_safe_index_replaced_by_index-2040055-4.patch, failed testing.

cs_shadow’s picture

Sorry. The last patch failed testing because I rolled it against wrong branch. This patch should work.

cs_shadow’s picture

Status: Needs work » Needs review
loudmu’s picture

patch didn't work for me

OlyN’s picture

I re-rolled the patch in #6 to match the currently latest commit (6316555dbd6c4217e9068cde757bef61342f40f6).

Status: Needs review » Needs work

The last submitted patch, 9: title-undefined-safe-value-rerolled-2040055-9.patch, failed testing.

flux423’s picture

Status: Needs work » Needs review
FileSize
542 bytes

Greetings all,
This is my first time sharing a patch with the community!
Please tell me if I'm doing this wrong.

I've created a patch to work on the current version 7.x-1.0-alpha7.

Please review and test.

Status: Needs review » Needs work
flux423’s picture

Here's a revised patch to this issue.

Disregard this post.

flux423’s picture

Ops.. wrong name to the patch. Re-rolling this to be correct.

flux423’s picture

Status: Needs work » Needs review
FileSize
542 bytes

The patch above needs review.

Status: Needs review » Needs work

The last submitted patch, 15: undefined_safe_index_replaced_by_index-2040055-15.patch, failed testing.

visabhishek’s picture

Status: Needs work » Needs review
FileSize
542 bytes

Re-Rolled Patch

Status: Needs review » Needs work

The last submitted patch, 17: notice_undefined-2040055-17.patch, failed testing.

visabhishek’s picture

Version: 7.x-1.0-alpha7 » 7.x-1.x-dev
Status: Needs work » Needs review

Moving to latest Dev Branch

trumanru’s picture

Status: Needs review » Reviewed & tested by the community

Works fine!

Thank you, visabhishek!

sgurlt’s picture

Confirm, #17 works fine.

plach’s picture

Status: Reviewed & tested by the community » Fixed
FileSize
707 bytes
+++ b/title.field.inc
@@ -97,7 +97,7 @@ function title_field_formatter_settings_summary($field, $instance, $view_mode) {
+  $output = isset($items[0]) ? $items[0]['value'] : '';

This solution would introduce an XSS vulnerability: we need to ensure we always use a save value instead (see the attached patch).

  • plach authored 876abe8 on 7.x-1.x
    Issue #2040055 by flux423, cs_shadow, visabhishek, plach, OlyN: Fixed...
plach’s picture

Status: Fixed » Closed (fixed)

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