i am not sure here, check it first.
This creates a error if "$meta['current'][$key][$subkey]" it not a array ('firstimage' is string)
$meta['current'][$key][$subkey] = !empty($meta['current'][$key][$subkey]) ? array_merge($meta['current'][$key][$subkey], $subvalue) : $subvalue;
like this, no problems, even with empty arrays
$meta['current'][$key][$subkey] = is_array($meta['current'][$key][$subkey]) ? array_merge($meta['current'][$key][$subkey], $subvalue) : $subvalue;