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-21214 Fix crashes when 'null' string is passed in via API #11324

Merged
merged 1 commit into from
Nov 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CRM/Core/BAO/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public static function add(&$params, $fixAddress) {
}

// (prevent chaining 1 and 3) CRM-21214
if (CRM_Utils_Array::value('master_id', $params)) {
if (isset($params['master_id']) && !CRM_Utils_System::isNull($params['master_id'])) {
self::fixSharedAddress($params);
}

Expand Down Expand Up @@ -537,7 +537,7 @@ public static function &getValues($entityBlock, $microformat = FALSE, $fieldName
$values['display'] = $address->display;
$values['display_text'] = $address->display_text;

if (is_numeric($address->master_id)) {
if (isset($address->master_id) && !CRM_Utils_System::isNull($address->master_id)) {
$values['use_shared_address'] = 1;
}

Expand Down Expand Up @@ -1031,7 +1031,7 @@ public static function processSharedAddress($addressId, $params) {

// unset contact id
$skipFields = array('is_primary', 'location_type_id', 'is_billing', 'contact_id');
if (CRM_Utils_Array::value('master_id', $params)) {
if (isset($params['master_id']) && !CRM_Utils_System::isNull($params['master_id'])) {
// call the function to create a relationship for the new shared address
self::processSharedAddressRelationship($params['master_id'], $params['contact_id']);
}
Expand All @@ -1046,7 +1046,7 @@ public static function processSharedAddress($addressId, $params) {
$addressDAO = new CRM_Core_DAO_Address();
while ($dao->fetch()) {
// call the function to update the relationship
if (CRM_Utils_Array::value('master_id', $params)) {
if (isset($params['master_id']) && !CRM_Utils_System::isNull($params['master_id'])) {
self::processSharedAddressRelationship($params['master_id'], $dao->contact_id);
}
$addressDAO->copyValues($params);
Expand Down