Deprecated function: Automatic conversion of false to array is deprecated in video_embed_field_get_video_data() (line 520 of /home/USER/public_html/sites/all/modules/video_embed_field/video_embed_field.module).

Created on 19 April 2023, over 1 year ago
Updated 27 July 2024, 4 months ago

Sorry, I can not provide more debugging information.

I am getting this error after upgrading to PHP 8.1.

Deprecated function: Automatic conversion of false to array is deprecated in video_embed_field_get_video_data() (line 520 of /home/USER/public_html/sites/all/modules/video_embed_field/video_embed_field.module).

I think we should check all elements of an array are set before using them:

/**
 * Gets a video data array for a given video url.
 *
 * @param string $url
 *   A video URL of the data array you want returned.
 *
 * @return array|false
 *   An array of video data, or FALSE on error.
 */
function video_embed_field_get_video_data($url) {
  $handler = video_embed_get_handler($url);
  if ($handler && isset($handler['data_function']) && function_exists($handler['data_function'])) {
    $data = call_user_func($handler['data_function'], $url);
    $data['handler'] = $handler['name']; // This line is giving me the error
    return $data;
  }
  return FALSE;
}

Source: https://git.drupalcode.org/project/video_embed_field/-/blob/7.x-2.x/vide...

🐛 Bug report
Status

RTBC

Version

2.0

Component

Code

Created by

🇨🇦Canada Nathan Tsai

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024