1

We are using UpStream template on our WP site. After the last WP 4.8 update, we are getting an error message on the administration panel, which does not allow us to use the slideshow. The error is the following:

Fatal error: Uncaught Error: Function name must be a string in /var/www/vhost/calamburteatro.com/home/html/wp-content/themes/UpStream/lib/Admin.php:248 Stack trace: #0 /var/www/vhost/calamburteatro.com/home/html/wp-content/themes/UpStream/lib/Admin.php(451): ThematerAdmin->form_callback('featuredposts_s...', Array) #1 /var/www/vhost/calamburteatro.com/home/html/wp-content/themes/UpStream/lib/Admin.php(388): ThematerAdmin->optionsPageContentItems(Array) #2 /var/www/vhost/calamburteatro.com/home/html/wp-content/themes/UpStream/lib/Admin.php(324): ThematerAdmin->optionsPageContent() #3 /var/www/vhost/calamburteatro.com/home/html/wp-includes/class-wp-hook.php(298): ThematerAdmin->ThematerThemeOptions('') #4 /var/www/vhost/calamburteatro.com/home/html/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array) #5 /var/www/vhost/calamburteatro.com/home/html/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #6 /var/www/vhost/calamburteatro.com/home/html/wp-admin/admin.php(222): do_action('appearance_page...') #7 / in /var/www/vhost/calamburteatro.com/home/html/wp-content/themes/UpStream/lib/Admin.php on line 248

The line 248 on the admin.php is: $callback[0]->$callback[1]();

And the whole fuction code is:

function form_callback ($name, $attributes = array())
    {
        if(isset($attributes['callback']) && is_array(($attributes['callback']))) {
            $callback = $attributes['callback'];
            $callback[0]->$callback[1]();
        } else {
            if(function_exists($name)) {
                return $name($attributes);
            }
        }

    }

Would anybody help us with this, please? Thanks in advance!

1 Answer 1

0

This is a generic PHP question, but simple to answer. The problem is most likely caused by PHP 7.

Simply change the line:

$callback[0]->$callback[1]();

to

$callback[0]->{$callback[1]}();

This is because $callback[0]->$callback[1](); means $callback[0]->{$callback[1]}(); in PHP5, while it means ($callback[0]->$callback)[1](); in PHP7.

Take a look into this page to know the details about the change.

1
  • @auroryx You're welcome! You can mark the answer as accepted, if it solved your issue.
    – Johansson
    Jun 19, 2017 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.