Problem/Motivation
// If the default query back-end is used generate SQL query strings from
// the query objects.
if ($build_info[$index] instanceof Select) {
$query = clone $build_info[$index];
$query->preExecute();
$build_info[$index] = (string)$query;
}
}
This code converts the query to a string, but ignores actual arguments entirely.
Proposed resolution
Do it like Drupal 7:
if ($build_info[$index] instanceof SelectQueryInterface) {
$query = clone $build_info[$index];
$query->preExecute();
$key_data['build_info'][$index] = array(
'sql' => (string) $query,
'arguments' => $query->getArguments(),
);
}
Remaining tasks
User interface changes
API changes
Comments
Comment #1
wim leersComment #2
fabianx commentedOh, wow ... Nice catch!
Comment #3
dawehnerBefore we forget that.
Comment #4
wim leersThe fix is simple, but the tests may not be. Anyway, tagging. The closely related #2452317: Let views result cache use cache contexts recently was fixed.
Comment #5
catchLooks like a duplicate of #1055616: Query arguments should be replaced before generating cache ID.
Comment #6
fabianx commentedEspecially https://www.drupal.org/node/1055616#comment-9513975 is very important.
Comment #7
Anonymous (not verified) commentedComment #8
Anonymous (not verified) commentedComment #9
keyral commentedHi , My patch to resolved your problem.
Comment #11
keyral commentedComment #12
keyral commentedComment #13
Anonymous (not verified) commentedComment #15
keyral commentedComment #16
keyral commentedComment #17
dawehnerAlright, now we need to have support for a proper test.
Comment #18
jcnventuraAs per #17, this needs a test.
Comment #19
keyral commentedMy commit solves the problem ? no ?
Comment #20
fabianx commented#19: Yes, it does! Great work!
But we need to ensure that no-one changes this code back, hence we need a "test-only" patch that shows the tests failing and exposes the bug.
Comment #21
nlisgo commentedWe need a comma at the end of the last array element.
See: https://www.drupal.org/coding-standards#array
Comment #22
dimaro commentedAdd a comma at the end.
Comment #23
dimaro commentedComment #24
jcnventuraStill needs the test.
Comment #25
jcnventuraAnd here's the patch, including the test.. I believe the interdiff is irrelevant in this case.
Comment #26
jcnventuraComment #27
nlisgo commented@jcnventura thanks for the test on this. It would be useful to provide a test only patch for this.
Comment #28
jcnventuraUploading a test-only patch as requested.
Comment #30
nlisgo commentedRTBC +1
I have read all of the lines of the patch and would recommend that this can be accepted as is.
Comment #31
nlisgo commentedJust noticed a small thing.
needs a comma at the end of the line
Comment #32
dawehnerThe test coverage really looks great!
Yeah, IMHO this doesn't add that much of test coverage. I guess you needed it during development of the test ...
Comment #33
pec commentedAdded the commas where needed
Comment #37
dimaro commentedCreate new version of patch removing deprecated drupal_render() function.
Comment #38
dimaro commentedI have seen that in some areas of the code short array syntax is used.
We should extend throughout the test?
Comment #39
fabianx commentedRTBC
#32: Explicitly checking for the filter plugin does make sense here IMHO as we rely on it later and that is what asserts are for.
Comment #40
nlisgo commentedRTBC +1
Comment #42
catchSo fix is the same as 7.x, and the test coverage looks exactly what we need.
Committed/pushed to 8.0.x, thanks!