Avoid fatal error when Pulling an item that has been Pulled already on a different site #1159
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: