I'm getting this notice when viewing a node where the YouTube field is empty:

Notice: Undefined index: und in youtube_tokens() (line 387 of youtube.inc)

The node display is controlled by Panels, using a "Node being viewed" content pane... not sure if that's relevant.

Comments

markabur created an issue. See original summary.

markabur’s picture

I'm also seeing this notice pointing at line 395 rather than line 387:

Notice: Undefined index: und in youtube_tokens() (line 395 of youtube.inc)

alan-ps’s picture

Status: Active » Needs review
StatusFileSize
new1.92 KB

We should check whether some value exists in a field for next tokens: youtube_video_url, youtube_image_url.

I added a patch which adds necessary checks.

markabur’s picture

Status: Needs review » Reviewed & tested by the community

  • guschilds committed 5605358 on authored by alan-ps
    Issue #2653920 by alan-ps, markabur: Fixed undefined index in token...

  • guschilds committed 237309f on
    Issue #2653920 by alan-ps, guschilds: Fixed improperly built tokens when...

  • guschilds committed f29b5f9 on
    Issue #2653920: Replaced token with empty string when the field has no...
guschilds’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the patch and testing.

I was able to confirm the bug existed and committed the patch to the 7.x-1.x branch. Another commit replaces the token with an empty string if the field didn't have a value. I also confirmed that tokens were improperly replaced in the 8.x-1.x branch when the field doesn't have a value. I ported the patch to that branch and committed it there as well.

Status: Fixed » Closed (fixed)

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