Illegal string offset ‘taxonomy’ in

Most likely the problem comes from:

$terms = get_the_terms( $post->ID, $args['taxonomy'] );

i.e. you have to make sure it’s not false or WP_Error object.

You should also check the output of:

var_dump( $args );

Try for example:

if( ! is_array( $terms ) )
    return $output;

or

if( ! $terms || is_wp_error( $terms ) )
    return $output;

before your loop.