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/issues/726, Fixed fatal error when searched using group type #13603

Merged
merged 1 commit into from
Mar 17, 2019

Conversation

pradpnayak
Copy link
Contributor

@pradpnayak pradpnayak commented Feb 14, 2019

Overview

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

Before

before

After

after

Comments

Error occurs when there is no group of Mailing list or Access list.

@civibot
Copy link

civibot bot commented Feb 14, 2019

(Standard links)

@eileenmcnaughton
Copy link
Contributor

@pradpnayak is this something that we can replicate in a unit test?

@eileenmcnaughton
Copy link
Contributor

test this please

@pradpnayak
Copy link
Contributor Author

pradpnayak commented Feb 15, 2019

@eileenmcnaughton sure, will do!

@eileenmcnaughton
Copy link
Contributor

I tested & confirmed that I can replicate this & the above fixes - once you get a chance to add a test it's all good IMHO

@eileenmcnaughton
Copy link
Contributor

@jitendrapurohit how does this tie into the one you just submitted? (@pradpnayak was going to do a test but hasn't gotten to that)

@jitendrapurohit
Copy link
Contributor

If I apply this fix with or without my PR applied, I get a DB syntax error on my usecase described at #13727 (comment) as the where clause that will be formed on searching contacts => groups => is null would be -

WHERE  (  (  ( ( `civicrm_group_contact-5c77bcc5c2eb5`.group_id IS NULL 0  ) )  )  )

Notice the 0 added at the end of the condition in all the cases. Maybe, we should limit it more to not execute this line in case of empty or null operators.

@eileenmcnaughton
Copy link
Contributor

Yes, early return makes sense - we might also try using

CRM_Core_DAO::createSQLFilter

to generate the string.

We obviously don't have much test cover on this fn

@eileenmcnaughton
Copy link
Contributor

This really does want a test but I'm gonna let it slip through without as

  1. it's clearly a bug fix & is replicable
  2. I'm confident it is a very safe fix
  3. it's stalled for a bit & since it's also kinda trivial & @pradpnayak has a strong track record of adding tests I'm gonna push it in rather than out

@eileenmcnaughton eileenmcnaughton merged commit 8dc65d8 into civicrm:master Mar 17, 2019
@jitendrapurohit
Copy link
Contributor

jitendrapurohit commented May 16, 2019

The error mentioned above still replicates for us. This time it displayed a fatal error on one of the mailing page -

image

Steps in https://lab.civicrm.org/dev/core/issues/768 can be followed to replicate it easily on search builder.

We fixed it by -

if (empty($regularGroupIDs) && strpos($op, 'NULL') === FALSE) {
   $regularGroupIDs = [0];
}

@eileenmcnaughton @pradpnayak does it makes sense to avoid this assignment for NULL operators?

@eileenmcnaughton
Copy link
Contributor

@jitendrapurohit are we ignoring the op later on?

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