Upgrade to wordpress 4.2.2


After wordpress upgrade to 4.2.2 version. I get the message Invalid argument supplied for foreach() in /h5p/h5p-php-library/h5p.classes.php on line 1558. How to solve?

icc's picture


That is strange. Can you please check your web server's error_log for futher details?
Also please double check that the wp-content/upload/h5p/temp folder is writable by the web server.


Yes it is writable. Info from error log a lot of lines with entry: File does not exist /public_html/404.shtml

Can it be the bug? As this message is shown on content types

icc's picture

No, I think that is another issue with you web server's setup. It seems like you're missing a custom 404 page.

icc's picture

Did you just update WordPress, or did you also update the H5P module?



icc's picture

Please try and check if there are any files or folders in wp-content/uploads/h5p/temp/

Also if you could add this line of code before line 1558 in wp-content/plugins/h5p/h5p-php-library/h5p.classes.php:
print $dir . ' - ' . count(glob($dir . '/*')) . '<br/>';

After that you try to save the H5P content again and copy the text output to this forum post.

What kind of web host are you using?


Here is text output:

public_html/wp-content/uploads/h5p/temp/3 - 6
public_html/wp-content/uploads/h5p/temp/3/FontAwesome - 6
public_html/wp-content/uploads/h5p/temp/3/H5P.Dialogcards - 6
public_html/wp-content/uploads/h5p/temp/3/H5P.Dialogcards/css - 1
public_html/wp-content/uploads/h5p/temp/3/H5P.Dialogcards/js - 1
public_html/wp-content/uploads/h5p/temp/3/H5P.Dialogcards/language - 4
public_html/wp-content/uploads/h5p/temp/3/H5P.JoubelUI - 5
public_html/wp-content/uploads/h5p/temp/3/H5P.JoubelUI/css - 9
public_html/wp-content/uploads/h5p/temp/3/H5P.JoubelUI/css/joubel-grep-dialog-box - 1
public_html/wp-content/uploads/h5p/temp/3/H5P.JoubelUI/fonts - 4
public_html/wp-content/uploads/h5p/temp/3/H5P.JoubelUI/js - 10
public_html/wp-content/uploads/h5p/temp/3/H5P.JoubelUI/js/joubel-grep-dialog-box - 2
public_html/wp-content/uploads/h5p/temp/3/H5PEditor.VerticalTabs - 4
public_html/wp-content/uploads/h5p/temp/3/content - 5
public_html/wp-content/uploads/h5p/temp/3/content/audios - 1

Should I delete TEMP folder? or change the rights?

icc's picture

That is strange. Everything looks like it should.
Yes, you could try deleting the temp folder and see if you get any new error messages. The folder should be recreated automatically.

I have the latest version of wordpress and when I install the pluggin the following error appear and then the plugin is not working correctly:

The plugin generated 584 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

Is anything wrong?

icc's picture

Hi! This isn't normal. To find out what is wrong we need to know what the "unexpected output" is. Could you please check your web server's error log for futher details?

I also get a message about characters of unexpected output (I think mine was more than 584 but I didn't copy the message so I don't know) and the plugin isn't working at all. I can create content but when I click "view" I see nothing at all.

I have Wordpress 4.2.2 hosted on WP engine.

Uninstalled it and reinstalled it, this is the message I get: "The plugin generated 1014 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin."

icc's picture

I'll do so more testing and see if i can reproduce the error.

Could you please try to check your error log? Instructions for WP Engine: http://wpengine.com/support/how-do-i-access-the-phpapache-error-log-for-my-account/

This is happening when I install the official pluggin 1.5 in wordpress (latest version 4.2.2) in my server. Then when I try to create content I am getting different errors:

In "my results" section: "TypeError: self.table is undefined" (with Firebug)

When I create a new Content:

Unable to find constructor for: H5P.MultiChoice 1.3h5p.js?ver=1.5.0 (line 732)TypeError: instance is undefined And more errors with direbug. Soemthing is wrong with th pluggin and wordpress version (4.2.2)
icc's picture

The plugin will most likely not work properly if you get error messages upon activation. What web hosting are you using? You should be able to access a file called error_log, which will describe the error encountered upon activating the plugin. If you're hosting this your self the file should be located at /var/log/apache/error_log or something similar.

Enabling define('WP_DEBUG', true); in wp-config.php might print the errors to your browser when you activate the H5P plugin.

Please note that this plugin does work for others so it's most likely something related to your web setup. Either way we'll be happy to help, and hopefully we can make H5P easier to use for everyone.

I found my error log (attached) but I have no idea what it means. It does have a lot of "Permission denied" messages and a search for h5p gets over 1000 results. So it looks like something went wrong during installation, and while I was using the plug-in.

Would be great if you could take a look and see what the problem is. If it's with my host I can contact them.

icc's picture

Thank you so much. It seems like there's an issue with too big keys in the database. I guess WP Engine has reduced their max size below the standard option. We have created a fix for this issue by reducing our key sizes so that the plugin should work. Do you think you could test the changes before we release a new version of the plugin?

In order to test you'll have to delete the H5P plugin and then download it again, but before you activate the newly downloaded plugin you'll have to replace a file named "class-h5p-plugin.php" in the "public" folder. An updated version of the file can be found here. To download it you'll have to right click the button label "raw" and then choose "Save link as...". When the file has been replaced with the new one you should be able to active and use the plugin.

If this works the fix will be a part of the next plugin version, and hopefully it will help many more.

Thank you for helping me with this. That fix sounds awesome and if I can only figure out where to put it I would be happy to test it. Do you know how I can get to the public folder on WP Engine or the Wordpress menu? I have tried googling but can't find anything.

Nevermind, as soon as I sent that I found it!

Tested it and it runs perfectly now. Thank you so much for the quick help!

icc's picture

Good, I'm glad to help.

I'll make sure this fix becomes a part of the upcoming release.