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

Fix api bug whereby 0 & '0' are not accepted as range parameters for BETWEEN #13766

Merged
merged 1 commit into from
Mar 6, 2019

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Fix api bug whereby 0 & '0' are not accepted as range parameters for BETWEEN

Before

These api calls are rejected

    civicrm_api3($this->_entity, 'get', [
      'contact_id' => ['BETWEEN' => [0, 9]],
    ]);
     civicrm_api3($this->_entity, 'get', [
      'contact_id' => ['BETWEEN' => [-9, 0]],
    ]);

After

Above calls succeed

Technical Details

In other news I'm not thrilled about the 0 casting to a string here but that is for another time

Comments

@civibot
Copy link

civibot bot commented Mar 5, 2019

(Standard links)

@civibot civibot bot added the master label Mar 5, 2019
@eileenmcnaughton eileenmcnaughton force-pushed the api_between branch 3 times, most recently from 43ee7af to da4ba14 Compare March 5, 2019 11:02
…BETWEEN

In other news I'm not thrilled about the 0 casting to a string here but that is for another time
$this->callAPISuccess($this->_entity, 'get', [
'contact_id' => [
'BETWEEN' => [
(0 - 9),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

honestly this -9 - I've tried so many formatting variants & been rejected by the style checker- hence the weirdly laid out array. Now resorting to making it a calculation

@eileenmcnaughton
Copy link
Contributor Author

merging based on Erik's review - this is also pretty safe, trivial & tested

@eileenmcnaughton eileenmcnaughton merged commit 417aef1 into civicrm:master Mar 6, 2019
@eileenmcnaughton eileenmcnaughton deleted the api_between branch March 6, 2019 20:05
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.

2 participants