Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM_Case_Form_Activity - Fix PHP warning when opening case #2077

Merged
merged 1 commit into from
Nov 26, 2013

Conversation

totten
Copy link
Member

@totten totten commented Nov 24, 2013

No description provided.

@dlobo
Copy link

dlobo commented Nov 24, 2013

Seems like this function and the class it extends break the signature of the original function in CRM/Core/Form.php

we might want to fix the signature in the Activity_Form_Activity class

lobo

@totten
Copy link
Member Author

totten commented Nov 25, 2013

Yes, the blame is really with CRM_Activity_Form_Activity which makes the questionable design decision of adding an extra (optional) param to an overridden function. However, it is legal in PHP 5.3.14 and 5.4.4. The warning shows up on CRM_Case_Form_Activity (in PHP 5.4.4).

Just to restate what's going on, the class hierarchy here has a few levels, and the signatures of the overloaded functions look this in the current official code:

  1. CRM_Core_Form::postProcess()
  2. CRM_Activity_Form_Activity::postProcess($params = NULL)
  3. CRM_Case_Form_Activity::postProcess() (==> warning <==)

The PR changes the hierarchy of overrides so that it's:

  1. CRM_Core_Form::postProcess()
  2. CRM_Activity_Form_Activity::postProcess($params = NULL)
  3. CRM_Case_Form_Activity::postProcess($params = NULL)

This fixes the warning for me in PHP 5.4.4. (If you still get a warning in PHP 5.5, then I guess the rules have changed.) It sounds like the ideal patch would be to have:

  1. CRM_Core_Form::postProcess()
  2. CRM_Activity_Form_Activity::postProcess()
  3. CRM_Case_Form_Activity::postProcess()

However, I can't really figure out when CRM_Activity_Form_Activity::postProcess is called with $params (ie can't find anything with grep), so I don't know how we would test the change. Maybe we could merge the current PR into 4.4 and then do the better change for 4.5?

@ghost ghost assigned dlobo Nov 25, 2013
dlobo pushed a commit that referenced this pull request Nov 26, 2013
CRM_Case_Form_Activity - Fix PHP warning when opening case
@dlobo dlobo merged commit 4c4bfe7 into civicrm:4.4 Nov 26, 2013
@totten totten deleted the 4.4-case-warning branch August 19, 2019 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants