dev/core#1347 - Fix php warning in advanced search when opening some accordions #15650
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
https://lab.civicrm.org/dev/core/issues/1347
When opening some accordions on advanced search, the accordion might not have a mapping for $mode, so $mode ends up being false, which gives a warning when used in array_key_exists. The warning doesn't show on screen for some reason, even if you have messages to the screen enabled, but does show up in drupal watchdog.
Before
Warning: array_key_exists(): The first argument should be either a string or an integer in CRM_Contact_Form_Search::getModeValue() (line 305 of .../CRM/Contact/Form/Search.php)
After
""
Technical Details
I wasn't sure if the right fix is to add a mapping, but I'm not sure even what effect the code has anyway because even when there is a mapping e.g. for the activities section, at the point the warning is appearing it still doesn't actually change the mode, which is controlled by the mode field at the top of the form.
Comments