Repository navigation
Conversation
CRM_Event_Form_Registration::setFeeDefaults() is only called from CRM_Event_Form_Registration_Register and CRM_Event_Form_Registration_AdditionalParticipant, both subclasses of CRM_Event_Form_Registration. CRM_Event_Form_Task_Register extends CRM_Event_Form_Participant instead, so get_class($this) can never match it here and the in_array() condition is always false. The check was carried over from the shared EventFees implementation when this function was copied into CRM_Event_Form_Registration, where Participant and Task_Register are valid callers. Removing it preserves the existing behaviour for the front-end registration forms: full options are still not preselected. The equivalent check in CRM_Event_Form_EventFees::setDefaultValues() remains valid and is unchanged. No behaviour change. AI disclosure: This contribution was human-driven, written with the AI coding agent DeepSeek V4.1 Flash 1017, human-reviewed.
|
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
PR commands & links...
|
civireview
left a comment
There was a problem hiding this comment.
CiviReview: 🟢 Ready · 5/5 ★★★★★
Removes an unreachable in_array(get_class($this), ['CRM_Event_Form_Task_Register']) check from CRM_Event_Form_Registration::setFeeDefaults(). Full default price options are still skipped on front-end registration forms.
No findings above the confidence gate.
✅ CI · ✅ Base tests · ✅ Surface
Verification (3 checks, 1 not verified)
Merge confidence (5/5): No verified issues; passed CI / Jenkins, Base-Test Regression, Live Surface Diff.
PR: civicrm/civicrm-core#38305 · Profile: core · Kind: core-bugfix · Commits: f2fba12 → 76b2891
| Check | Status | Detail |
|---|---|---|
| CI / Jenkins | ✅ PASS | 1 CI checks: 1 passed, 0 failed, 0 pending. |
| Base-Test Regression | ✅ PASS | 62 test(s) passed on A and B |
| Live Surface Diff | ✅ PASS | Live APIv4/APIv3/routes/Afform surface diff captured with 0 risk flags. |
Not verified:
- No added/modified PHPUnit tests in PR; Proof-of-Fix A/B test skipped.
More: Walkthrough · blast radius
Walkthrough
- CONFIRMED:
CRM_Event_Form_Task_RegisterextendsCRM_Event_Form_Participant(CRM/Event/Form/Task/Register.php:26), andCRM_Event_Form_RegistrationextendsCRM_Core_Form(CRM/Event/Form/Registration.php:22).get_class($this)insidesetFeeDefaults()therefore can never be'CRM_Event_Form_Task_Register', so the removed!in_array(...)check was always true. - CONFIRMED: the only callers of
setFeeDefaults()(protected, defined at Registration.php:2304) are Registration/Register.php:230 and Registration/AdditionalParticipant.php:142. Both are subclasses ofCRM_Event_Form_Registration. The simpler!empty($values['is_full'])check at Registration.php:2363 gives the same result as before. An extension subclass also cannot be namedCRM_Event_Form_Task_Register, because that class name already belongs to core. - CONFIRMED: the diff changes one file, +2/-1. It removes the dead clause and adds a comment. There are no schema, API, template or behaviour changes.
- PROVEN: the CiviKitchen A/B base-test-regression run passed all 62 Event form tests on both A and B, with no regressions. Jenkins passed 1 of 1 checks.
- No test was added, so the Proof-of-Fix A/B run was skipped. That is fine here: the change removes unreachable code and has no observable behaviour to test.
Ecosystem blast radius
| Repo | Path | Symbol | Impact |
|---|---|---|---|
| civicrm-core | CRM/Event/Form/Registration/Register.php |
CRM_Event_Form_Registration_Register::setDefaultValues |
Calls setFeeDefaults(); full options are still never preselected, so behaviour is unchanged. |
| civicrm-core | CRM/Event/Form/Registration/AdditionalParticipant.php |
CRM_Event_Form_Registration_AdditionalParticipant::setDefaultValues |
Calls setFeeDefaults(); behaviour is unchanged. |
Automated AI-assisted review, alpha: it may miss issues or report false positives, so verify findings before acting and open an issue with feedback. Reviewed by civireview · sonnet-opus · 199,823 tokens · $0.26
|
I agree it's unreachable. Thanks @Sjord |
in_arrayis never true, because CRM_Event_Form_Registration does not extend CRM_Event_Form_Task_Register. Remove it.CRM_Event_Form_Registration::setFeeDefaults() is only called from CRM_Event_Form_Registration_Register and
CRM_Event_Form_Registration_AdditionalParticipant, both subclasses of CRM_Event_Form_Registration. CRM_Event_Form_Task_Register extends CRM_Event_Form_Participant instead, so get_class($this) can never match it here and the in_array() condition is always false.
The check was carried over from the shared EventFees implementation when this function was copied into CRM_Event_Form_Registration, where Participant and Task_Register are valid callers. Removing it preserves the existing behaviour for the front-end registration forms: full options are still not preselected. The equivalent check in CRM_Event_Form_EventFees::setDefaultValues() remains valid and is unchanged.
No behaviour change.
AI disclosure: This contribution was human-driven, written with the AI coding agent DeepSeek V4.1 Flash 1017, human-reviewed.
Overview
in_arrayis never true, because CRM_Event_Form_Registration does not extend CRM_Event_Form_Task_Register. Remove it.Before
After
Technical Details
Comments