Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mykkal opened this issue Feb 15, 2023 · 24 comments
Closed

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

mykkal opened this issue Feb 15, 2023 · 24 comments
Labels
Milestone

Comments

@mykkal
Copy link

mykkal commented Feb 15, 2023

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 kylegilman added this to the 4.8.7 milestone Feb 15, 2023
@kylegilman
Copy link
Owner

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
Copy link
Author

mykkal commented Feb 15, 2023

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.

@mykkal mykkal closed this as completed Feb 15, 2023
@mykkal mykkal reopened this Feb 15, 2023
@kylegilman
Copy link
Owner

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

@mykkal
Copy link
Author

mykkal commented Mar 6, 2023

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
Copy link
Owner

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
Copy link
Author

mykkal commented Mar 9, 2023 via email

@mykkal
Copy link
Author

mykkal commented Mar 9, 2023

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

@kylegilman
Copy link
Owner

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
Copy link
Author

mykkal commented Mar 10, 2023 via email

@mykkal
Copy link
Author

mykkal commented Mar 10, 2023 via email

@mykkal
Copy link
Author

mykkal commented Mar 10, 2023 via email

@mykkal
Copy link
Author

mykkal commented Mar 11, 2023

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
Copy link
Owner

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
Copy link
Author

mykkal commented Mar 21, 2023

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
Copy link
Owner

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

@mykkal
Copy link
Author

mykkal commented Mar 21, 2023

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
Copy link
Author

mykkal commented Mar 21, 2023

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
Copy link
Author

mykkal commented Mar 21, 2023

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

@mykkal
Copy link
Author

mykkal commented Mar 24, 2023

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

@kylegilman
Copy link
Owner

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
Copy link
Author

mykkal commented May 2, 2023

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
Copy link
Author

mykkal commented May 30, 2023

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

@kylegilman
Copy link
Owner

Sorry @mykkal, I'm totally stumped.

@mykkal
Copy link
Author

mykkal commented Jul 11, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants