Q:

Passing function params

I have a foreach statement that looks like the following:
foreach ($term['terms'] as $term_single) {
    $term_object = get_term_by('name', $term_single, $tax_name);

    switch ($term['tax_name']) {
        case has_action( "basey_taxonomy_search_teaser_{$tax_name}" ) :
            do_action( "basey_taxonomy_search_teaser_{$tax_name}",$term_object, $term_single );
        break;

        default:
            echo basey_taxonomy_search_teaser_default($term_object,$term_single);
        break;
    }
}

So, within this, I have both the $term_object and $term_single variables to pass to the basey_taxonomy_search_teasr_default() function. The odd thing here is, if I do the following in another location:
function basey_taxonomy_search_teaser_default($term_object,$term_single) {

    ob_start();

    do_action('basey_taxonomy_teaser_before');
    echo '<article id="tax-' . $term_object->term_id . '" class="' . $term_object->taxonomy . '">';
    echo '<a href="';
    echo get_term_link($term_object);
    echo '">';
    echo $term_single;
    echo '</a>';
    echo '</article>';
    do_action('basey_taxonomy_teaser_after');

    $display = apply_filters('basey_taxonomy_teaser_default_view', ob_get_clean());
    return $display;
}

it works just fine on my localhost, but online at a server, it is coming back with errors for $term_object and $term_single as undefined. If I want the function definition to use the values from the initial call, is there a better way to do so? Again little confused on why it would work here on localhost (MAMP) but on the server, it would error out. Aside from it being a php.ini issue (which I think this is more fundamental programming practice), looking to see what I'm doing wrong and if my assumptions are off on passing values via a function. Thanks!
Update
var_dump($term_object) right after $term_object = get_term_by('name', $term_single, $tax_name);:
localhost gives me:
object(stdClass)#181 (10) { ["term_id"]=> string(3) "127" ["name"]=> string(4) "Base" ["slug"]=> string(4) "base" ["term_group"]=> string(1) "0" ["term_order"]=> string(1) "0" ["term_taxonomy_id"]=> string(3) "130" ["taxonomy"]=> string(18) "profile_categories" ["description"]=> string(4) "Base" ["parent"]=> string(1) "0" ["count"]=> string(1) "2" }

live server gives me:
bool(false)

Bah, quite frustrating.

A:

I'd guess that the DB you're hitting is different and the $term_single is null, leading to a null $term_object, and when you call the function and try to use the objects that's where you're dying.

