Within a multisite instance, if you Pull an item from one site to another (say from Site A to Site B), the original item has the connection details stored in the dt_connection_map meta.
If you then pull that same item into a different site (say from Site A into Site C) we check if the original item has that meta and if so, we check to see if the current site ID exists within that meta (which would indicate a duplicate item).
The problem here is the code we run looks for a different structure than what we actually have. Unsure if this is a new bug coming out of the v2 release or if this is a long standing issue that just hasn't been found. EDIT: Tested further and seems to be something that was always an issue but PHP 8.1 (maybe 8.0 but didn't test that) started throwing a fatal error instead of just a warning. So anyone running PHP 7.4 or less wouldn't see this.
This PR fixes this by using the correct data structure.
Closes #1158
How to test the Change
Set up a WordPress multisite with Distributor active and at least three sites in place
Create a piece of content on the first site
On the latest released version of Distributor, Pull this content into the second site
Then try pulling this content into the third site. A PHP fatal error should happen
Check out this PR, create a new piece of content on the first site and run through the steps again
No PHP fatals should happen
Changelog Entry
Fixed - Avoid a PHP fatal error when pulling content that has previously been pulled into a different network site
Description of the Change
Within a multisite instance, if you Pull an item from one site to another (say from Site A to Site B), the original item has the connection details stored in the
dt_connection_map
meta.If you then pull that same item into a different site (say from Site A into Site C) we check if the original item has that meta and if so, we check to see if the current site ID exists within that meta (which would indicate a duplicate item).
The problem here is the code we run looks for a different structure than what we actually have. Unsure if this is a new bug coming out of the v2 release or if this is a long standing issue that just hasn't been found. EDIT: Tested further and seems to be something that was always an issue but PHP 8.1 (maybe 8.0 but didn't test that) started throwing a fatal error instead of just a warning. So anyone running PHP 7.4 or less wouldn't see this.
This PR fixes this by using the correct data structure.
Closes #1158
How to test the Change
Changelog Entry
Credits
Props @dkotter, @jeffpaul
Checklist: