Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The accept_exposed_input function checks for the presence of either 1 and 2 operands, but the 'Is empty / Is not empty' filters have 0 operands - which makes the check always fail, so the filter does not have any effect when it's exposed.
Attached patch fixes this by bringing the code in line with views_handler_filter_date::validate_valid_time()
.
Original report:
In the accept_exposed_input function it checks for 1 and 2 operands, but filtering for NULL and not NULL is a 0 operand filter.
This might help (views_handler_filter_date.inc, line 149)
} elseif ($operators[$operator]['values'] != 0) {
if ($this->value['min'] == '' || $this->value['max'] == '') {
return FALSE;
}
} else {
$this->value['type'] = $type;
return true;
}
Comment | File | Size | Author |
---|---|---|---|
#5 | 1776332-views_handler_filter_data_empty_not_empty.patch | 509 bytes | andrewbelcher |
Comments
Comment #1
andrewbelcher CreditAttribution: andrewbelcher commentedI think really it should be checking explicitly for a need for 2 values like it does in
views_handler_filter_date::validate_valid_time()
:Attached is a patch that fixes it.
Comment #2
roderikGood catch on spotting
views_handler_filter_date::validate_valid_time()
. (I tried to fix this bug myself and wasn't sure how to construct the 'if block' exactly.) That means it doesn't really need any comments, IMHO.(As for the related issue: its description says the same as what this patch fixes -except in D6 language-, but the patch under discussion seems to do a lot more than that. I think this patch should just be committed first, because it fixes the immediate bug.)
Comment #3
roderikComment #4
colanWe've recently switched our testing from the old qa.drupal.org to DrupalCI. Because of a bug in the new system, #2623840: Views (D7) patches not being tested, older patches must be re-uploaded. On re-uploading the patch, please set the status to "Needs Review" so that the test bot will add it to its queue.
If all tests pass, change the Status back to "Reviewed & tested by the community". We'll most likely commit the patch immediately without having to go through another round of peer review.
We apologize for the trouble, and appreciate your patience.
Comment #5
andrewbelcher CreditAttribution: andrewbelcher at FreelyGive commentedHave re-uploaded the patch.
Comment #6
vitalie CreditAttribution: vitalie commentedThanks, patch #5 works for me.
Comment #7
DuneBLI have tried to group all the patches/issues about this problem into one issue: https://www.drupal.org/node/2704699
Comment #8
deetergp CreditAttribution: deetergp at Classic Graphics commentedPatch #5 also worked for me. I have included it in my distro build. Thanks!
Comment #9
ikeigenwijs CreditAttribution: ikeigenwijs commentedPatch #5 also worked for me.
Comment #10
Aurangzeb_Alamgir CreditAttribution: Aurangzeb_Alamgir commented#5 works for me as well.
Comment #11
Aurangzeb_Alamgir CreditAttribution: Aurangzeb_Alamgir commented#5 works for me as well.
Comment #12
colanIs this also a problem in D8? If so, we'd need to create another issue.
Comment #13
Aurangzeb_Alamgir CreditAttribution: Aurangzeb_Alamgir as a volunteer commentedYes, I just confirmed this to be a problem in the latest 8.4.x branch. Fixing this is just as easy, but I really don't know yet how to open issues and submit patches properly. Maybe somebody can guide me or do it with this patch for d8:
Comment #14
colanAurangseb: Thanks for looking into this! First, create an issue in the "Drupal core" (short name: "drupal") project. We need to use Drupal core for this because Views is in core in Drupal 8.
Then, these two guides should help you:
Please cross-reference the D7 and D8 issues by linking back and forth. Once done, we can move forward with each.
Comment #15
Aurangzeb_Alamgir CreditAttribution: Aurangzeb_Alamgir as a volunteer commentedCreated the D8 bug report and added a relation to this issue.
Comment #16
colanThanks!
Comment #17
presleyd CreditAttribution: presleyd commentedThis works for me to. Could we get this into next release?
Comment #18
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 3 year old patch in #5 to views_handler_filter_date.inc does not apply to the latest 7.x-3.x-dev and needs a reroll.
Comment #19
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedMy mistake everyone, this patch does apply to the latest 7.x-3.x HEAD.
thanks,
Comment #21
DamienMcKennaComment #23
DamienMcKennaCommitted. Thanks.