• Resolved programmin

    (@programmin)


    PHP calls to “\WP_STATISTICS\Pages::record()”, previously working with the plugin, is now causing an error:

    Uncaught ArgumentCountError: Too few arguments to function WP_STATISTICS\Pages::record(), 0

    after upgrading to wp-statistics 14.8

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mostafa Soufi

    (@mostafas1990)

    Weird indeed since this method is calls here and also have the parameter https://github.com/wp-statistics/wp-statistics/blob/master/includes/class-wp-statistics-hits.php#L165

    Can you please tell me what is your PHP version? additionally, maybe would be good to upgrade the plugin manually.

    Thread Starter programmin

    (@programmin)

    PHP7.4 I believe.

    I note this issue because other developers probably will need to update their code if they call the same function – is there a developer’s update you publish upon major updates like this?

    Plugin Author Mostafa Soufi

    (@mostafas1990)

    Thank you for the information. It’s clear now that you’re calling the \WP_STATISTICS\Pages::record() method directly.

    The error you’re encountering, “Uncaught ArgumentCountError: Too few arguments to function WP_STATISTICS\Pages::record(), 0“, is because this method now requires an argument, specifically an instance of \WP_Statistics\Service\Analytics\VisitorProfile.

    In the recent updates, the method signatures and expected parameters have been adjusted. While we typically anticipate developers to use the Hits::record() method, which internally handles the instantiation and passing of the required parameters, direct calls to Pages::record() need to be updated accordingly.

    Here’s how you can adjust your code to accommodate the new method signature:

    $visitorProfile = new \WP_Statistics\Service\Analytics\VisitorProfile();
    \WP_STATISTICS\Pages::record($visitorProfile);

    If you have any further questions or need additional assistance, please don’t hesitate to reach out.

    Best

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Exception after upgrade Wp-statistics 14.8’ is closed to new replies.