• Resolved alx359

    (@alx359)


    Noticed after the 4.1.1 update, getting this error while trying to access the Dashboard:

    Uncaught Error: Call to a member function getItems() on string in \wp-content\plugins\wp-analytify\inc\wpa-core-functions.php:451

    Skimming through the place of the error, on line ~449, modifying this:

    } else {

    to this:

    } elseif( is_object( $accounts ) ) {

    seems to address the issue.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @alx359

    Sorry for the inconvenience at your end.

    We have tested the release on different environments and didn’t face such an issue.

    Please let us know the steps you took that ended up in this fatal error so we can also replicate the issue.

    You can also help us further investigating the issue by contacting us at:
    https://analytify.io/support/

    Looking forward,

    Thread Starter alx359

    (@alx359)

    Hi Asad,
    I haven’t done much really. The 4.1.1 update came with a notice to upgrade analytics.js:

    Analytify introduced the new gtag.js tracking mode. Switch it now from plugin Advanced settings to use recommended Google Analytics gtag.js tracking method

    To make that notice go away, I did as it suggests. I don’t use the plugin’s dashboard much, as I prefer the widget. Hitting Analytify > Dashboards now lands on a “There has been a critical error on this website” notice, and debug.log has the aforementioned entry. Suspecting a bug with this release, I even tried rolling back to a few previous versions of wp-analytify, but the error still occurs for me. Skimming through the latest code now, it becomes apparent it handles $accounts being null/empty/false, or an array, but there’s no check for $accounts not being an object. I don’t know why mine isn’t, but an is_object($accounts) check right before using the foreach clause seems consistent with the rest of the code.

    Thank you for providing a detailed explanation.

    This issue is not reported by other users since the release and there were no changes related to this specific functionality in the last release.

    I believe you have applied the fix (you mentioned above) in the code at your end.

    If you are facing any further issues please contact us at our support channel, our dedicated developer will help you sort the issues out on your site.

    https://analytify.io/support/

    Thread Starter alx359

    (@alx359)

    I looked some more into the issue.

    The reason for the error happens from fetch_profiles_list_summary() fetching the profiles_list_summary option from the DB, which contains a long json string that appears to be malformed in my configuration. I deleted that option and it got re-fetched, apparently properly formatted this time, as it fixed the issue. I compared both strings and they’re indeed different.

    As said in the previous post, I noticed this error in the current version, but it goes way back, as I don’t open the dashboard much but prefer the widget instead.

    Looking at both json strings now, noticed references to domain.com in the malformed one and www.domain.com in the re-fetched one. Some time ago, I indeed changed the websiteUrl from domain.com to www.domain.com side-wide for SEO purposes, so perhaps something got messed up (although haven’t noticed any other issues so far).

    I understand this would be an edge case to the team, hence the unwillingness to address it. As probably is well known it’s a good practice to do at least a basic check of any data fetched from a remote origin. So still considering an extra check to $accounts containing properly formed json data would make the code a bit more resilient, and error handling some more graceful.

    HTH.

    We have already added the proper checks during the fetch process and they will be available in the upcoming reaslese.

    I believe the string that was stored in profiles_list_summary on the DB must have contained the error information.

    We will try to reproduce the issue on our end using the info you have provided.

    Thank you again! We are obliged that you are concerned about our plugin.

    Cheers!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP Fatal error’ is closed to new replies.