• Resolved hirschferkel

    (@hirschferkel)


    I tried to update my Worpress-Site to PHP 8.1 but it will throw a fatal error and it looks like the reason is code-snipped. Is it possible?

    wp/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()’d code on line 8

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter hirschferkel

    (@hirschferkel)

    Tried several 8.x versions and Code-Snippet will always break it. Is there any fix for it?

    Deactivating Code-Snippet will make the site work.

    thrown in /var/www/vhosts/hostingxyz/homepage/wp/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()’d code on line 8
    [08-Feb-2024 18:23:34 UTC] PHP Fatal error: Uncaught Error: Undefined constant “condition” in /var/www/vhosts/hostingxyz/homepage/wp/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()’d code:8
    Stack trace: 0 /var/www/vhosts/hostingxyz/homepage/wp/wp-content/plugins/code-snippets/php/snippet-ops.php(582): eval() 1 /var/www/vhosts/hostingxyz/homepage/wp/wp-content/plugins/code-snippets/php/snippet-ops.php(663): Code_Snippets\execute_snippet() 2 /var/www/vhosts/hostingxyz/homepage/wp/wp-includes/class-wp-hook.php(324): Code_Snippets\execute_active_snippets() 3 /var/www/vhosts/hostingxyz/homepage/wp/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() 4 /var/www/vhosts/hostingxyz/homepage/wp/wp-includes/plugin.php(517): WP_Hook->do_action() 5 /var/www/vhosts/hostingxyz/homepage/wp/wp-settings.php(506): do_action() 6 /var/www/vhosts/hostingxyz/homepage/wp/wp-config.php(104): require_once(‘/var/www/vhosts…’) 7 /var/www/vhosts/hostingxyz/homepage/wp/wp-load.php(50): require_once(‘/var/www/vhosts…’) 8 /var/www/vhosts/hostingxyz/homepage/wp/wp-admin/admin-ajax.php(22): require_once(‘/var/www/vhosts…’) 9 {main}

    thrown in /var/www/vhosts/hostingxyz/homepage/wp/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()’d code on line 8

    Thread Starter hirschferkel

    (@hirschferkel)

    O.k. I was able to narrow it down. Creating a PHP Snippet do deactivate Gutenberg blocks will cause the fatal error:

    <?php //Remove Gutenberg Block Library CSS from loading on the frontend function smartwp_remove_wp_block_library_css(){ wp_dequeue_style( 'wp-block-library' ); wp_dequeue_style( 'wp-block-library-theme' ); wp_dequeue_style( 'wc-blocks-style' ); // Remove WooCommerce block CSS } add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css', 100 );

    or similar one, will not work, too.

    Any idea?

    //Remove Gutenberg Block Library CSS from loading on the frontend
    function smartwp_remove_wp_block_library_css(){
    wp_dequeue_style( ‘wp-block-library’ );
    wp_dequeue_style( ‘wp-block-library-theme’ );
    }

    add_action( ‘wp_enqueue_scripts’, ‘smartwp_remove_wp_block_library_css’ );if (condition) {

    }

    Thread Starter hirschferkel

    (@hirschferkel)

    It’s not limited to this shortcode there are more than this code which throw errors …

    thrown in /var/www/vhosts/hostingxyz/hompage/wp/wp-content/plugins/code-snippets/php/front-end/class-frontend.php(248) : eval()’d code on line 3

    Thread Starter hirschferkel

    (@hirschferkel)

    I edited the snippets again and again. maybe 50 times. And somehow it runs, now. I do absolutely not know what caused this issue after updating to PHP 8.x

    Maybe it was some kind of server cache? I don’t know. It does run again at the end …

    Plugin Author Shea Bunge

    (@bungeshea)

    This is entirely down to your snippet. You have a random if (condition) {} at the end for some reason.

    I recommend taking some time to format the snippet code properly to avoid issues like this.

    Thread Starter hirschferkel

    (@hirschferkel)

    As I wrote I was able to fix it. But it was no problem for 1 year with PHP 7.4. And the other snipped did not have any wrong code at all.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘PHP 8.1.27 – Fatal Error’ is closed to new replies.