Title: Error PHP 8
Last modified: January 7, 2023

---

# Error PHP 8

 *  Resolved [Patrick Horemans](https://wordpress.org/support/users/winock/)
 * (@winock)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/error-php-8-5/)
 * Hi i use thes widget with php code on php7.4 everything ok
 * with php 8 i have an error….
 * **Warning**: Undefined variable $post in **/**xxxxxxx**/wp-content/plugins/php-
   code-widget/execphp.php(27) : eval()’d code** on line **2**
   **Warning**: Attempt
   to read property “ID” on null in **/**xxxxxxx**/wp-content/plugins/php-code-widget/
   execphp.php(27) : eval()’d code** on line **2****Warning**: Undefined variable
   $post in **/**xxxxxxx**/wp-content/plugins/php-code-widget/execphp.php(27) : 
   eval()’d code** on line **3****Warning**: Attempt to read property “ID” on null
   in **/xxxxxxx/wp-content/plugins/php-code-widget/execphp.php(27) : eval()’d code**
   on line **3**
 * My code:
 *     ```wp-block-code
       <?php
       if (get_the_terms($post->ID, 'ausstattung')) {
         $taxonomy_ar = get_the_terms($post->ID, 'ausstattung');
       echo "";
         $output = '<ul>';
         foreach ($taxonomy_ar as $taxonomy_term) {
           $output .= '<li>'. $taxonomy_term->name .'</li>';
         }
         $output .= '</ul>';
   
         echo $output;
       }
       ?>
       ```
   
 * What is wrong?
 * Please Help…. i m a noob in PHP
    -  This topic was modified 3 years, 4 months ago by [Patrick Horemans](https://wordpress.org/support/users/winock/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [3 years, 1 month ago](https://wordpress.org/support/topic/error-php-8-5/#post-16689387)
 *  The problem is the code you put into the widget is not valid. It is not the 
   widget itself. The giveaway is the “eval’d code” section. Those indicate that
   the errors came from your code in the widget.
 *  Specifically, you did not declare the $post as a global.

Viewing 1 replies (of 1 total)

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

 * ![](https://ps.w.org/php-code-widget/assets/icon.svg?rev=992095)
 * [PHP Code Widget](https://wordpress.org/plugins/php-code-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/php-code-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/php-code-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/php-code-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/php-code-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/php-code-widget/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/error-php-8-5/#post-16689387)
 * Status: resolved