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

dev/core#795 Fix PHP warning when updating a multiselect country field. #13858

Merged
merged 1 commit into from
Mar 19, 2019

Conversation

mlutfy
Copy link
Member

@mlutfy mlutfy commented Mar 19, 2019

Overview

https://lab.civicrm.org/dev/core/issues/795

Steps to reproduce:

  • Create a new custom field for Contacts of type Country - Multiselect.
  • Run the following test script:
<?php

\Drupal::service('civicrm')->initialize();

error_reporting(E_ALL);
$result = civicrm_api3( 'Contact', 'create', [
  'id' => 131,
  'custom_33' => [1039, 1041],
]);

Resulting warning:

explode() expects parameter 2 to be string, array given CustomValueTable.php:127

Before

warning

After

no warning

Technical Details

Seems like a pretty obvious error in the code. Mostly harmless, but warnings are annoying. According to the git blame, it's been like that forever (pre-2013).

The warning was not visible when using the API explorer or when updating a contact record through the normal CiviCRM interface.

@civibot civibot bot added the master label Mar 19, 2019
@civibot
Copy link

civibot bot commented Mar 19, 2019

(Standard links)

@yashodha
Copy link
Contributor

looks good, can be merged.

@mlutfy
Copy link
Member Author

mlutfy commented Mar 19, 2019

Thanks @yashodha - I've taken the liberty to add 'merge-on-pass'

@colemanw colemanw merged commit 3f56c6f into civicrm:master Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants