• Resolved getzero11

    (@getzero11)


    Hello,

    We have the following error with version 3.1.0, while updating an existing WooCommerce related snippet that worked in version 2.14.6.

    Strangely, there is no syntax error (php code already checked with multiple online tools) and the snippet can be updated without any problem on the local server settings.

    Additional info:
    1. Hosting: SiteGround + Cloudflare
    2. Cache Plugin: SiteGround Optimizer

    Don't Panic
    The code snippet you are trying to save produced a fatal error on line 8:
    
    syntax error, unexpected ' ' (T_STRING), expecting ')'
    The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.
    
    Please use the back button in your browser to return to the previous page and try to fix the code error. If you prefer, you can close this page and discard the changes you just made. No changes will be made to this site.

    WooCommerce error log:

    2022-06-02T04:45:05+00:00 CRITICAL syntax error, unexpected ' ' (T_STRING), expecting ')' in /website.com/public_html/wp-content/plugins/code-snippets/php/admin-menus/class-edit-menu.php(248) : eval()'d code on line 8

    Looking forward to your expert advice.
    Thanks.

    • This topic was modified 2 years, 9 months ago by getzero11.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    Can you post the code here? It’s a bit difficult to say what could be going wrong without it.

    Thread Starter getzero11

    (@getzero11)

    Thanks for your quick response.

    This is part of the code that’s throwing an error (line 7, in this case).

    if ( !isset($markup['aggregateRating'])) {
        $checked = !$product->get_review_count() && wc_review_ratings_enabled();
        if ($checked) {
          $markup['aggregateRating'] = array(
            '@type'       => 'AggregateRating',
            'ratingValue' => 4.7,
            'reviewCount' => 1,
          );
        }
      }

    Thanks again.

    Plugin Author Shea Bunge

    (@bungeshea)

    Can you post the full code snippet as you are using it on the site where it is crashing?

    Thread Starter getzero11

    (@getzero11)

    The full code snippet can be shared only privately with you for the proprietary reasons. Is there a way to do it?

    Plugin Author Shea Bunge

    (@bungeshea)

    You can contact me at shea [at] codesnippets [dot] pro

    Thread Starter getzero11

    (@getzero11)

    Resolved with version 3.1.1. Thank you.

    Plugin Author Shea Bunge

    (@bungeshea)

    Thank you for the update! I’m not sure what the issue was – the only thing that really changed between v3.1.0 and v3.1.1 were with the download/export feature, but I am glad to hear that it is working now.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Fatal error on updating snippet’ is closed to new replies.