Take the array key into account when matching up FOREIGN KEYs in DatabaseTableChangeP...
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 3 Aug 2021 14:13:58 +0000 (16:13 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 3 Aug 2021 14:22:15 +0000 (16:22 +0200)
commit167291206e57ffb9bc043308682061e5e499ff45
tree46d58541552b13f620451a9147a0501da4460710
parent810b076f8c5517055fef5b616852f611efe59fd3
Take the array key into account when matching up FOREIGN KEYs in DatabaseTableChangeProcessor

Previously a FOREIGN KEY within the database that looks like this:

    […] FOREIGN KEY (someOtherUserID) REFERENCES wcf1_user (userID) […]

would match up a FOREIGN KEY definition like the following:

    […] FOREIGN KEY (userID) REFERENCES wcf1_user (userID) […]

Converted into the `getDiffData()` representation of the PHP DDL API these
would like:

    [ 'columns'           => 'someOtherUserID'
    , 'referencedColumns' => 'userID'
    , 'referencedTable'   => 'wcf1_user'
    ]

and

    [ 'columns'           => 'userID'
    , 'referencedColumns' => 'userID'
    , 'referencedTable'   => 'wcf1_user'
    ]

respectively.

Now taking the diff of the second array against the first array (subtracting
the first from the second) will remove *both* 'userID' values, resulting in an
empty difference, thus believing both FOREIGN KEYs are identical

Fix this issue by using `array_diff_assoc` which will also take the key into
account.
wcfsetup/install/files/lib/system/database/table/DatabaseTableChangeProcessor.class.php