kylegilman / video-embed-thumbnail-generator

A WordPress plugin that generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted videos. Requires FFMPEG or LIBAV for encoding.
http://wordpress.org/plugins/video-embed-thumbnail-generator/
GNU General Public License v2.0
48 stars 27 forks source link

Video Pack Fatal Issue: Warning: Invalid argument supplied for foreach #519

Closed mykkal closed 1 year ago

mykkal commented 1 year ago

My apologies. I tried emailing you about this. I found the issue but cannot fix it myself.

I'm getting errors returned from videopack that cause the site to crash from time to time. The video queue stays empty and no videos are converted.

The error is: Warning: Invalid argument supplied for foreach() in /****/****/public_html/wp-content/plugins/video-embed-thumbnail-generator/src/admin/videopack-ffmpeg.php on line 2528

I found an article that explains a fix for this issue: educative.io/answers/fixing-the-invalid-argument-supplied-for-foreach-php-error

Would really appreciate the help or work around if you have one.

This is affecting https://ironpalmtattoos.com

kylegilman commented 1 year ago

Somehow your video encode queue has a value in it that's not empty and not an array. I'll have to do some digging to figure out how that could happen. But in the meantime I'll add a check to make sure it's an array before starting the foreach loop. I'll try to get an update out soon.

mykkal commented 1 year ago

Much appreciated. Do you think it could be due to data corruption?

If you need access to the installation please let me know. Any idea when you'd planned to release the next version?

I do appreciate your work Kyle. You have a very mature product. Hopefully you won't have to deal with bugs soon.

kylegilman commented 1 year ago

Ha! There will always be more bugs. I just put out an update that I hope will solve this bug though.

mykkal commented 1 year ago

Bug seems to be back. Am now getting.

Warning: foreach() argument must be of type array|object, string given in /wp-content/plugins/video-embed-thumbnail-generator/src/admin/videopack-ffmpeg.php on line 1590

kylegilman commented 1 year ago

I made more thorough checks to avoid that error, but I'd love to know what the string is in your encode queue. Are you able to look in your database to see what the 'kgvid_video_embed_queue' entry is in the wp_options table?

mykkal commented 1 year ago

deleted for security

mykkal commented 1 year ago

I couldn't post all of it. I'm not sure its been working at all.

kylegilman commented 1 year ago

It's a good idea to avoid posting your full server path publicly. I deleted the data, but it was the beginning of what looked like a normal serially encoded array. Without the whole array I can't tell what's causing the problem, but it's possible your queue is so big that it's running out of room to save the whole thing and so when it's read, it can't be unserialized and turned into an array. Can you try pasting the whole thing here? https://www.unserialize.com/ See if that gives you an error.

mykkal commented 1 year ago

I'll be happy to do that for you. Is there no scalable way to handle large queue? I actually don't have that many videos uploaded so i'm a little confused. I think that wpcron isn't running however.

Mike McKoy 770-203-8805

On Fri, Mar 10, 2023 at 9:33 AM Kyle Gilman @.***> wrote:

It's a good idea to avoid posting your full server path publicly. I deleted the data, but it was the beginning of what looked like a normal serially encoded array. Without the whole array I can't tell what's causing the problem, but it's possible your queue is so big that it's running out of room to save the whole thing and so when it's read, it can't be unserialized and turned into an array. Can you try pasting the whole thing here? https://www.unserialize.com/ See if that gives you an error.

— Reply to this email directly, view it on GitHub https://github.com/kylegilman/video-embed-thumbnail-generator/issues/519#issuecomment-1463889593, or unsubscribe https://github.com/notifications/unsubscribe-auth/A456OINBFR2EXV4NEZOSFQDW3M3TXANCNFSM6AAAAAAU4KREXE . You are receiving this because you modified the open/close state.Message ID: <kylegilman/video-embed-thumbnail-generator/issues/519/1463889593@ github.com>

mykkal commented 1 year ago

Also here's a screen capture of some weird characters now appearing on the pages. I went ahead and disabled the plugin to protect SEO

On Fri, Mar 10, 2023 at 10:25 AM Mike McKoy @.***> wrote:

I'll be happy to do that for you. Is there no scalable way to handle large queue? I actually don't have that many videos uploaded so i'm a little confused. I think that wpcron isn't running however.

Mike McKoy 770-203-8805

On Fri, Mar 10, 2023 at 9:33 AM Kyle Gilman @.***> wrote:

It's a good idea to avoid posting your full server path publicly. I deleted the data, but it was the beginning of what looked like a normal serially encoded array. Without the whole array I can't tell what's causing the problem, but it's possible your queue is so big that it's running out of room to save the whole thing and so when it's read, it can't be unserialized and turned into an array. Can you try pasting the whole thing here? https://www.unserialize.com/ See if that gives you an error.

— Reply to this email directly, view it on GitHub https://github.com/kylegilman/video-embed-thumbnail-generator/issues/519#issuecomment-1463889593, or unsubscribe https://github.com/notifications/unsubscribe-auth/A456OINBFR2EXV4NEZOSFQDW3M3TXANCNFSM6AAAAAAU4KREXE . You are receiving this because you modified the open/close state.Message ID: <kylegilman/video-embed-thumbnail-generator/issues/519/1463889593@ github.com>

mykkal commented 1 year ago

[image: image.png]

Mike McKoy 770-203-8805

On Fri, Mar 10, 2023 at 10:26 AM Mike McKoy @.***> wrote:

Also here's a screen capture of some weird characters now appearing on the pages. I went ahead and disabled the plugin to protect SEO

On Fri, Mar 10, 2023 at 10:25 AM Mike McKoy @.***> wrote:

I'll be happy to do that for you. Is there no scalable way to handle large queue? I actually don't have that many videos uploaded so i'm a little confused. I think that wpcron isn't running however.

Mike McKoy 770-203-8805

On Fri, Mar 10, 2023 at 9:33 AM Kyle Gilman @.***> wrote:

It's a good idea to avoid posting your full server path publicly. I deleted the data, but it was the beginning of what looked like a normal serially encoded array. Without the whole array I can't tell what's causing the problem, but it's possible your queue is so big that it's running out of room to save the whole thing and so when it's read, it can't be unserialized and turned into an array. Can you try pasting the whole thing here? https://www.unserialize.com/ See if that gives you an error.

— Reply to this email directly, view it on GitHub https://github.com/kylegilman/video-embed-thumbnail-generator/issues/519#issuecomment-1463889593, or unsubscribe https://github.com/notifications/unsubscribe-auth/A456OINBFR2EXV4NEZOSFQDW3M3TXANCNFSM6AAAAAAU4KREXE . You are receiving this because you modified the open/close state.Message ID: <kylegilman/video-embed-thumbnail-generator/issues/519/1463889593@ github.com>

mykkal commented 1 year ago

Okay so i found the conflict showing weird characters was unrelated. However i'm still getting these errors and the queue shows empty in wordpress while its full in the datbaase.

Warning: foreach() argument must be of type array|object, string given in /wp-content/plugins/video-embed-thumbnail-generator/src/admin/videopack-ffmpeg.php on line 1590

Not sure I can use the plugin or that its ever been functioning.

kylegilman commented 1 year ago

Did you try doing the unserialize on the full database entry? I don't know for sure what's causing your problem. I have heard that extremely large queues sometimes cause errors because of the way WordPress saves options, and since you weren't able to paste the whole queue I thought that might be it.

If wp-cron isn't working I would try to get it working. The problem could be related to whatever's stopping Videopack from working. WP Control is a good place to start when troubleshooting wp-cron.

mykkal commented 1 year ago

Okay wp cron appears to be fixed. However I still get this error: Warning: foreach() argument must be of type array|object, string given in /*****/public_html/wp-content/plugins/video-embed-thumbnail-generator/src/admin/videopack-ffmpeg.php on line 1590

kylegilman commented 1 year ago

Next step, try deleting the whole kgvid_video_embed_queue database entry in wp_options just to clear out all the junk.

mykkal commented 1 year ago

Alrighty so I cleared it out. We'll see if this works. I'll try to encode another video. I checked the wp-cron log and didn't see an event mentioning videopack. is there one?

Also the error has disappeared after I cleared the entries in the database as suggested. I didn't delete. Just cleared the field.

mykkal commented 1 year ago

Okay so I tried adding a video to the encoding queue and found no record of it in the database or the wordpress queue. As far as I can see the plugin hasn't worked in my environment since Dec 2022. That's when the last video uploaded was encoded into different formats.

Not seeing any errors since the db table is cleared. Should I delete the kgvid_video_embed_queue entry altogether?

mykkal commented 1 year ago

I created a test staging site if you want to take a look.

mykkal commented 1 year ago

Hey Kyle? Still on deck? I do need help still. Please.

kylegilman commented 1 year ago

You could try deleting the kgvid_video_embed_queue entry. It shouldn't make anything worse. What PHP version are you running on your server? Have you tried installing an older version of the plugin to see if it works? I'd try v4.7.5

mykkal commented 1 year ago

Hey Kyle, I did try and was able to encode some videos but I get a lot of errors.

Warning: Undefined array key 20 in /public_html/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php on line 4282

Warning: Undefined array key 20 in /public_html/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php on line 4348

Warning: Undefined array key 22 in /public_html/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php on line 4282

Warning: Undefined array key 22 in /public_html/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php on line 4348

Warning: Undefined array key 23 in /public_html/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php on line 4282

Warning: Undefined array key 23 in /public_html/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php on line 4348

Warning: Undefined array key 24 in /public_html/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php on line 4282

Warning: Undefined array key 24 in /public_html/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php on line 4348

Warning: Undefined array key 26 in /public_html/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php on line 4282

Warning: Undefined array key 26 in /public_html/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php on line 4348

Warning: Undefined array key 27 in /public_html/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php on line 4282

Warning: Undefined array key 27 in /public_html/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php on line 4348

Warning: Undefined array key 28 in /public_html/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php on line 4282

Warning: Undefined array key 28 in /public_html/wp-content/plugins/video-embed-thumbnail-generator/video-embed-thumbnail-generator.php on line 4348
mykkal commented 1 year ago

Hi Kyle, I know you're busy. Just wanted to follow up with you.

kylegilman commented 1 year ago

Sorry @mykkal, I'm totally stumped.

mykkal commented 1 year ago

Problem disappeared. Not sure what caused it. I think it may have been the theme Tattoo by Vamtam