PHP Warning (Undefined array key) when using ACF oEmbed in video block

Description:

Upon inserting a Cwicly Video block with ACF oEmbed field as dynamic source, I get a PHP warning on the frontend for every video. The warning message is: Warning : Undefined array key 1 in /cwicly/core/includes/classes/class-helpers.php on line 270

Step-by-step reproduction instructions:

  1. Install Cwicly 1.4.1.8 and ACF Pro 6.3.6
  2. Create ACF field group with type oEmbed.
  3. Create ACF content and add a youtube video to the oEmbed field (example: trailer of movie THX1138)
  4. In template, insert the Cwicly Video block and use the ACF oEmbed field as dynamic source.

** Actual result**

In the template editor, all is working fine. On the site frontend, the warning appears in the site header, and the video doesn’t play (the Youtube player shows a “An error occurred. Please try again later.”). The PHP warning appears with PHP 8.1.23. With the (unsupported) PHP 7.4.30, the warning doesn’t show up, but the video doesn’t play either.

Environment info

  • WordPress version: 6.6.1
  • Cwicly Plugin version: 1.4.1.8
  • LocalWP with PHP 8.1.23

Hello @ms-studio,

Thanks for the report.

Could you try setting the field type to link instead of oEmbed?

Thanks in advance.

Hello @Louis ,

Indeed, when using the “URL” field type, with the same video, it works: the youtube player is loading up fine.

2 Likes

PS: another solution :

If i use a Cwicly Paragraph block, with the dynamic data source being my ACF “oEmbed” field, the video also shows up fine on the frontend.

Hi @ms-studio If you do this, I recommend changing the html tag for the Paragraph block to div.

1 Like