Title: PHP 8 error
Last modified: February 10, 2023

---

# PHP 8 error

 *  Resolved [Austin Ginder](https://wordpress.org/support/users/austinginder/)
 * (@austinginder)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/php-8-error-30/)
 * I have Google Language Translator v6.0.18 running on a multisite network. Some
   of my subsites are seeing PHP fatals errors on the home page. My server is running
   PHP 8 so I suspect it’s just a compatibility issue. This is the error from the
   error log.
 *     ```wp-block-code
       PHP Fatal error: Uncaught TypeError: array_values(): Argument #1 ($array) must be of type array, null given in /wp-content/plugins/google-language-translator/google-language-translator.php:268
       ```
   
 * I was able to patch the code by changing that line to the following:
 *     ```wp-block-code
       $comma_separated = empty( $items ) ? $items : implode(",",array_values($items));
       ```
   

Viewing 1 replies (of 1 total)

 *  Plugin Author [edo888](https://wordpress.org/support/users/edo888/)
 * (@edo888)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/php-8-error-30/#post-16563619)
 * Hi,
 * The context is this:
 *     ```
       public function googlelanguagetranslator_included_languages() {
           $get_language_choices = get_option ('language_display_settings');
   
           foreach ($get_language_choices as $key=>$value):
             if ($value == 1):
               $items[] = $key;
             endif;
           endforeach;
   
           // -------> line 268
           $comma_separated = implode(",",array_values($items));
           $lang = ", includedLanguages:'".$comma_separated."'";
           return $lang;
         }
       ```
   
 * I have no idea how you can have a case when $items is null. Most likely language_display_settings
   is altered somewhere in the database and in that case it is good to have a fatal
   error to catch your attention and make sure the configuration is done properly.
 * Thanks! 🙂
    -  This reply was modified 3 years, 2 months ago by [edo888](https://wordpress.org/support/users/edo888/).

Viewing 1 replies (of 1 total)

The topic ‘PHP 8 error’ is closed to new replies.

 * ![](https://ps.w.org/google-language-translator/assets/icon-256x256.png?rev=3007649)
 * [Translate WordPress - Google Language Translator](https://wordpress.org/plugins/google-language-translator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/google-language-translator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/google-language-translator/)
 * [Active Topics](https://wordpress.org/support/plugin/google-language-translator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/google-language-translator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/google-language-translator/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [edo888](https://wordpress.org/support/users/edo888/)
 * Last activity: [3 years, 2 months ago](https://wordpress.org/support/topic/php-8-error-30/#post-16563619)
 * Status: resolved