Closed (fixed)
Project:
Drupal core
Version:
8.9.x-dev
Component:
database system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Mar 2018 at 02:42 UTC
Updated:
4 May 2020 at 10:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
dubcanada commentedPatch
Comment #3
pifagorI run tests
Comment #4
daffie commentedCan someone add testing for this or can post a query where this occurs.
Comment #6
dan.munn commentedHi, ran into the same problem when using ultimate_cron too, agree the function signature implies you can pass the class_name for StatementPrefetch and also PDOStatement (although the StatementInterface does not).
I've updated the patch with an additional test leveraging fetchObject with a classname (although no constructor).
Comment #8
dan.munn commentedTake #2 of the above, apologies although test ran, when trying to adding a record count check clearly didn't re-run the test - updated.
Comment #11
daffie commentedLets test the patch with only the test in it.
Comment #12
daffie commentedComment #13
neslee canil pintoPatch Rerolled for 9.1.x
Comment #15
neslee canil pinto@daffie, rerolled that patch against 9.1.x
Comment #16
daffie commented@Neslee: When you have done a reroll, you are supposed to remove the tag "Needs reroll". Also the added test will fail. For that I will change the status to "Needs work". Thanks for the reroll.
Comment #17
aleevasI've trued to fix last patch
Comment #18
daffie commented@aleevas: Could be so kind to also post a patch with the test and without the fix. The patch should fail, but then we know that the test is testing the fix.
Comment #19
daffie commentedThe same patch as that from comment #17 only without the fix. This way we see if the testing is testing the fix.
Comment #20
daffie commentedThe added test dos not test the bug fix.
Comment #21
johnwebdev commentedStatementPrefetch is used by Sqlite not MySQL.
Comment #22
daffie commentedYou are completely right @johndevman. Lets say that I was doing something else and I am no good at multitasking. :)
The bug fix looks good and the added test looks good.
The pacth with only the added test shows that the added test is testing the bug fix.
For me it is RTBC.
Comment #23
alexpottThe if here is strange. If the assertTrue fails then the test will halt so it's not necessary.
Also instead of
if ($this->assertTrue($result instanceof FakeRecord, 'Result is an object of class FakeRecord.')) {this should beYes this is copying other code in the class but it's all based on odd Simpletest conventions and not PHPUnit. $this->assertTrue returns NULL so amusingly none of these tests are testing what they think they are :) - can someone file a follow-up issue to fix all the tests in \Drupal\KernelTests\Core\Database\FetchTest() that are using the return value of assertTrue.
Comment #24
johnwebdev commentedAddresses #23.
Comment #25
johnwebdev commentedFollow up #3129074: Refactor assertions that use return values in conditionals
Comment #26
alexpott$records is not a countable thing... in other test methods $records is an array not an integer. That's why in #23 I went for
$this->assertSame(1, $records, 'There is only one record.');Comment #27
johnwebdev commented#26 Yeah, sorry about that.
Comment #30
daffie commentedThe code looks good.
All the points of @alexpott are addressed.
Back to RTBC.
Comment #31
alexpottCommitted b2a1019 and pushed to 9.1.x. Thanks!
Going to ask release managers about backporting this bugfix.
Comment #33
alexpottDiscussed with @catch and we agreed to backport this to 8.9.x