// CRM-19006: escape characters like comma, | before building regex pattern
$value = (array) $value;
foreach ($value as $key => $val) {
- $value[$key] = str_replace(array('|', '[', ']', ','), array('\|', '\[', '\]', '[:comma:]'), $val);
+ $value[$key] = str_replace(array('|', '[', ']', ','), array('[:spearator:]', '\[', '\]', '[:comma:]'), $val);
}
$value = implode(',', $value);
}
$value = $sp . $value . $sp;
if (!$wildcard) {
foreach (explode("|", $value) as $val) {
+ $val = str_replace('[:separator:]', '\|', $val);
$this->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($fieldName, $op, $val, 'String');
}
}
else {
+ $value = str_replace('[:separator:]', '\|', $value);
$this->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($fieldName, $op, $value, 'String');
}
}
$dataValues = array(
'integer' => array(1, 2, 3),
'number' => array(10.11, 20.22, 30.33),
- 'string' => array(substr(sha1(rand()), 0, 4), substr(sha1(rand()), 0, 3), substr(sha1(rand()), 0, 2)),
+ 'string' => array(substr(sha1(rand()), 0, 4) . '(', substr(sha1(rand()), 0, 3) . '|', substr(sha1(rand()), 0, 2) . ','),
// 'country' => array_rand(CRM_Core_PseudoConstant::country(FALSE, FALSE), 3),
// This does not work in the test at the moment due to caching issues.
//'state_province' => array_rand(CRM_Core_PseudoConstant::stateProvince(FALSE, FALSE), 3),