Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291765

lookupDestinationIds() gives confusing error if first lookup value is NULL

$
0
0

Problem/Motivation

If the Sql map plugin's lookupDestinationIds() method is given an array of $source_id_values containing a NULL, then the row fails with a message "Extra unknown items for map ....".

The message is confusing and incorrect, because the correct number of items for the map will have been passed in.

The problem is this line:

    $is_associative = !isset($source_id_values[0]);

If $source_id_values[0] is NULL, then this sets $is_associative to TRUE, incorrectly. The code that then tries to build up the $conditions looks for named array keys in $source_id_values, which don't exist. And then array values are left at the end of the process, and the MigrateException is thrown.

Steps to reproduce

Proposed resolution

Change this to array_key_exists().

The migration lookup probably has a problem if it's looking up a NULL, but it should fail for that rather than for an unrelated and incorrect problem.

Remaining tasks

- Create an issue fork and merge request
- Write an automated test
- Make the suggested fix
- Review the test for code standards and language

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet


Viewing all articles
Browse latest Browse all 291765

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>