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
Fix conditional check in MySQL setup #23760
Conversation
By analyzing the blame information on this pull request, we identified @bartv2, @DeepDiver1975 and @MorrisJobke to be potential reviewers |
Thanks for the fix @Xenopathic But in my specific case it didn't work: #23637 (comment) |
@@ -43,7 +43,7 @@ public function setupDatabase($username) { | |||
$query='select count(*) from information_schema.tables where table_schema=? AND table_name = ?'; | |||
$result = $connection->executeQuery($query, [$this->dbName, $this->tablePrefix.'users']); | |||
$row = $result->fetch(); | |||
if(!$result or $row[0]==0) { | |||
if(!$row or $row[0]==0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (empty($row[0])) {
should so the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I shudder at every usage of empty()
now, even if it might be appropriate usage...
13eb9d8
to
ee4ebdd
Compare
Further testing by me and @enoch85 showed that actually the whole conditional was broken... the result comes through as |
ee4ebdd
to
6734e0a
Compare
Tested and working! 👍 |
|
This is now in the VM: techandme/owncloud-vm@300cb2a |
Backport to stable 9 please? |
OK, I tested it - prior to this PR, running an install a second time on the same (already-existing) database fails during table creation. With this PR it doesn't fail on table creation, but rather hits a problem creating the admin user, since there is already an admin user in the user table. In other words, it seems to be working properly with this PR. For databases that aren't yet created, this PR works exactly the same as pre-PR, just without the 'Undefined offset' warning. Please review @DeepDiver1975 @MorrisJobke @bartv2 |
@Xenopathic Backport request? |
Broken since 114f128 @karlitschek for the backport |
great. please backport 👍 |
Backport of #23760 Fix conditional check in MySQL setup.
Backport to stable 9 is here: #23805 |
Should also backport to 8.2 |
Backport of "Fix conditional check in MySQL setup #23760"
|
[stable9] Fix conditional check in MySQL setup
6734e0a
to
440b5ca
Compare
Rebased onto master to fix the Ceph CI failures |
@DeepDiver1975 The stable9 backport has already been merged, this can be merged as soon as CI is finished |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The original check didn't make sense -
$result
is always an object, and always evaluates to true. I believe the intention of the check was if there is any rows in the result, so$row
needs to be checked.Might affect #23637 cc @enoch85