PHP 8 - Fatal error in CRM_Contribution_Form_ContributionCharts, passes substring instead of int to mktime() in year field
Overview
Contribution Dashboard crashes due to incorrectly passed arguments in the charts implementation
Reproduction steps
- Use PHP version 8.1
- Have a Contribution with a receive data before Year 1000 (Yes this will be bogus, but data is not always clean)
- Go to Contributions / Dashboard
Current behaviour
CiviCRM site crashes with:
Uncaught TypeError: mktime(): Argument #6 ($year) must be of type ?int, string given in /path/to/civicrm/CRM/Contribute/Form/ContributionCharts.php:176
Expected behaviour
Contributions dashboard is loaded
Environment information
- CiviCRM: Master, 5.66.2, 5.67
- PHP: 8.1.25
- CMS: WordPress 6.3.3
Comments
Was unable to reproduce this on dmaster, reason being that I don't know how the invalid date got in where I found the bug.