ipsips/acf-audio-video

PHP warning when $attachment_url is an array

Opened this issue · 3 comments

I'm not sure exactly why I'm running across this in my app... but I'm getting an array passed to _get_attachment_id_from_url rather than a string.

This is predictably throwing a warning strpos() expects parameter 1 to be string, array given acf-audio-video/acf-audio-video-field.php:380

I didn't hunt down the source of the error, but just checking that the passed variable $attachment_url is indeed a string resolves the warning for me.

I am experiencing this too. This is only when I try to replace a video. If the field is empty and a video is added, it works fine.
The commit referenced does not resolve the issue since it does not update the field when the array comes, it deletes its content.

I found the problem, is in this line

var name = !attName ? this.inputName : this.inputName + '[' + attName + ']';

An extra '[attName]' it's being added, which is already on the input name, resulting on a name of the form:
acf[field_555555][field_123123][mp4][mp4]

rolling back this line, to the previous version seems to work ok.

return this.$inputContainer.children(':first').attr('name');

@kara-todd, @aleberguer
Try to download and install this new plugin:
https://github.com/virgo79/acf-audio-video-player