When I create a new node / edit a node to attach a youtube video via media file selector, then I search video by typing Video ID, it will display errors about "Warning: Illegal string offset 'link' in media_youtube_add()".

It should be caused when only one result found in search.
As displayed in attached screenshot, it is no wrapper for $search['entry'] thus error occurred.

Screen Shot 2013-05-07 at 18.37.00.png109.66 KBenomoto


cbeier’s picture

Issue summary:View changes

Which version of the media module do you use?

I can confirm the warning messages with media 7.x-2.x-dev and 7.x-2.0-alpha3.
With media 7.x-1.4 the messages does not appear, because the media_youtube_add() is here not called.

The differenct array/data structure comes already from the Youtube API. If the search query only returns one result, the XML contains the entry directly. So, we need to normalize the returned structure from Youtube to avoid problems in the further processing.

cbeier’s picture

Ok, I have seen that the problem is already resolved in the current 7.x-2.x-dev branch.

So, I think we can close this issue. Marking as duplicate of #1668950: YouTube Tab: Fatal error: Cannot use string offset as array in sites/all/modules/media_youtube/media_youtube.module on line 175.