wp-cli / language-command

Installs, activates, and manages language packs.
MIT License
13 stars 21 forks source link

PHP Warning in CommandWithTranslation #60

Closed swissspidy closed 5 years ago

swissspidy commented 5 years ago

I'm currently getting the following PHP warnings when updating language packs on a site:

PHP Warning:  Invalid argument supplied for foreach() in phar:///usr/bin/wp/vendor/wp-cli/language-command/src/WP_CLI/CommandWithTranslation.php on line 95
Warning: Invalid argument supplied for foreach() in phar:///usr/bin/wp/vendor/wp-cli/language-command/src/WP_CLI/CommandWithTranslation.php on line 95
Success: Updated 0/0 translations.

The code in question is here:

https://github.com/wp-cli/language-command/blob/b17cdd8a56579489c1c007e69a6b30254372789c/src/WP_CLI/CommandWithTranslation.php#L88-L103

Looks like the code currently doesn't check whether $available_updates is actually set or is an array. We could add a continue statement in that case.

schlessera commented 5 years ago

Duplicate of #58