On the latest module upgrade, I got this warning:

warning: Invalid argument supplied for foreach() in /sites/all/modules/media_bliptv/media_bliptv.module on line 222.

It starts on the following line:

  foreach ($api['LINKS']['LINK'] as $link) {
    if ($link['TYPE'] == 'application/rss+xml') {
      $data['rss'] = $link['HREF'];
    }
  }

I'm guessing that the ['LINK'] subarray doesn't exist when retrieved from the server. You could just easily wrap that foreach() like this:
if (isset($api['LINKS']['LINK'])) { foreach... }.

Will this cause any problems, or can I just ignore it and assume the upgrade went through successfully?

CommentFileSizeAuthor
#3 media_bliptv.module.patch578 bytespcarman

Comments

hargobind’s picture

Update: I found that there was an old video node that had the EMBED code inside of the video field, rather than the URL from the video page. When trying to view this page, I noticed that the actual video wasn't even displaying.

Inside the database, the "Video ID" for that node was a mixed set of letters and numbers like "g653gZ7T4QA" rather than a numeric video ID. Once I went and grabbed the actual URL of the video page and put it into the video field, that seemed to have fixed the problem.

On a technical note, the update code was calling media_bliptv_metadata() inside of media_bliptv.module. Inside of that function, there are two calls to emvideo_bliptv_request(). Because $video_id was invalid, the function returned an empty array. So naturally the rest of the metadata gathering later in the function was skewed, hence the PHP warning mentioned above.

I don't think this is a critical problem since PHP warnings don't halt code execution, and the rest of my video nodes seem to have been updated successfully.

I would suggest to the module developers to add a verification somewhere in the update code that checks if the $video_id is numeric. If not, log an error to the Update page telling the admin that they need to update those video nodes. I think it's important for users to know about these invalid nodes because they don't even display correctly on the front-end.

hargobind’s picture

Title: Error upgrading to 6.x-1.0-beta1 - Invalid array value in $api variable » Error upgrading to 6.x-1.0-beta1 - Warning encountered when video nodes are still using EMBED code
pcarman’s picture

StatusFileSize
new578 bytes

I think this message comes up for when ever someone uses the embed code. That means even though they get a message to use the URL over the embed code, the warning still shows. Here is a patch that removes the warning message.

This patch does not fix existing videos with the embed code, but it does help with user who try to upload a new video with the embed code.