Closed (fixed)
Project:
Drupal core
Version:
8.7.x-dev
Component:
mysql db driver
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
31 Aug 2018 at 17:39 UTC
Updated:
2 Oct 2018 at 12:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
petiar commentedI can try to fix this, hopefully, it's not complicated.
Comment #3
petiar commentedPatch included.
Comment #4
mondrakeComment #5
webapp's commentedCode change in above patch works fine.
Comment #6
mondrakeThank you!
Let”s add a test to assert that no value is returned.
In the kernel test SchemaTest the method is called twice. It wuold be sufficient to wrap those calls in a
asserNull.Then let”s have here a test only patch and a combined test+fix patch.
Comment #7
petiar commentedHi all,
I am not very familiar with the tests, but I guess you wanted something like this? Let me know if that helps.
Thanks.
Petiar.
Comment #8
mondrakeYes, let's run tests to see if they are ok. Thanks!
Comment #10
andypostLooks great!
Comment #11
alexpottAs this is changing a return value for the most common DB I think we should have a change record. BC is hard here. It's perfectly reasonable for code to have done:
even though this is not documented by the API someone somewhere will depend upon this behaviour - especially since this is a hangover from Drupal 7 (interestingly though not Drupal 6)
And we should only make the change in 8.7.x to give people time to adapt any code.
Needs work for the change record. The patch and tests look great.
Comment #12
andypost@alexpott Not sure that return value is changing - before it was returning
NULL(in worst case\Drupal\Core\Database\Connection::handleQueryException()also returnsNULL) so I do not see how it may affect already existing code - I found it just typo thatreturnused for no reason. Also test in #7 shows that core at least always getting null return codeOtoh I see
\Drupal\Core\Database\Connection::defaultOptions()defines'return' => Database::RETURN_STATEMENTas result but it is always NULL at the end, so maybe there case when it could be not null... not sure - needs other pair of eyes on itComment #13
alexpott@andypost doesn't the test in #7 prove that the return value has changed for MySQL - from a \Drupal\Core\Database\StatementInterface object to a NULL?
Comment #14
andypost@alexpott the
removing-return-command-2996560-7-test.patchshows that statement returned for mysql only - I guess because default options but not clear how it could be used forComment #15
andypostFiled CR https://www.drupal.org/node/3000572
Comment #16
mondrakeI think with the CR this is now fine. The example code in #11 would have worked only for MySql, and failed with other drivers. Let's fix this inconsistency,
Comment #17
alexpottComment #18
alexpottThanks for the CR.
Committed 716828d and pushed to 8.7.x. Thanks!