Fix duplicate errors when config data is not different.

Perform a more careful inspection of config data when checking duplicates. Simply check the json_encode() value has issues when default config is involved. array_diff* have similar issues with nested data.

Since the empty config data will be the most common case the previous optimization is still valid and very useful.

Refs #5286