Fatal error visiting event registration page with a disabled pricefield
Overview
Opening a registration page with a priceset with one of the pricefields disabled results in a fatal error.
TypeError: Argument 1 passed to CRM_Event_Form_Registration::getUsedSeatsCount() must be of the type int, null given, called in /var/www/vhosts/xyz/web/sites/all/modules/civicrm/CRM/Event/Form/Registration.php on line 956 in CRM_Event_Form_Registration->getUsedSeatsCount() (line 1040 of /var/www/vhosts/xyz/web/sites/all/modules/civicrm/CRM/Event/Form/Registration.php).
The problem for us is somewhere in the function isOptionFullID. Something in our priceset does not resolve to valid value for $optId = $option['id'];
when from IsOptionFullID the function getUsedSeatsCount is called it results in an error because it expects an int value for priceFieldValueID protected function getUsedSeatsCount(int $priceFieldValueID) : int {
Reproduction steps
- An event has a priceset with one of the pricefields disabled
- Opening the registration page results in a fatal error
Current behaviour
Expected behaviour
The registration page would show, with the pricefield disabled
Environment information
Current master / sandbox
Comments
My limited detective and coding skills enable me to reach this far, I have no clue on where to search further and what piece of code is the root cause of this.