Skip to content

[PHP 8.1 compatibility] Fix array access warning on float - /plugins/Goals/DataTable/Filter/CalculateConversionPageRate.php #20636

@michalkleiner

Description

@michalkleiner

Context

Coming back to view the dashboard after a day without any new visits, I see two PHP warnings.

Expected Behavior

No warning displayed.

Current Behavior

Two instances of the warning appear when no data/goals for the movers/shakers widget, one for getPageTitles action and one for getPageUrls action.

Screenshot 2023-04-26 at 9 01 35 PM

WARNING: /plugins/Goals/DataTable/Filter/CalculateConversionPageRate.php(112): Warning - Trying to access array offset on value of type float - Matomo 5.0.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) (Module: API, Action: getOverallMoversAndShakers, Method: Actions.getPageUrls, In CLI mode: false)

WARNING: /plugins/Goals/DataTable/Filter/CalculateConversionPageRate.php(112): Warning - Trying to access array offset on value of type float - Matomo 5.0.0-b1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) (Module: API, Action: getOverallMoversAndShakers, Method: Actions.getPageTitles, In CLI mode: false)

Steps to Reproduce (for Bugs)

  1. Establish a fresh Matomo instance
  2. Use the Visits Generator to generate some visits
  3. Wait a day (I realise this is not a super-feasible/fast reproduction step, sorry)
  4. Observe the error in a fresh session (as it disappears on page refresh)

Your Environment

  • Matomo Version: 5.0.0-b1
  • PHP Version: 8.1.18
  • Server Operating System: MacOS
  • Additionally installed plugins:
  • Browser: Brave
  • Operating System: MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugFor errors / faults / flaws / inconsistencies etc.RegressionIndicates a feature used to work in a certain way but it no longer does even though it should.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions