WordPress.org

Ready to get started?Download WordPress

Forums

Polylang
[resolved] Call to undefined function get_current_screen() (4 posts)

  1. ReactorShop
    Member
    Posted 9 months ago #

    Hi Chouby,

    I downloaded my production server WordPress installation, which it's still using Polylang 1.1.6, into my testing environment.

    Right after updating it with Polylang 1.2.1, and then trying to navigate to another page inside the WordPress administration side, I get a white page and this server error logged entry:

    PHP Fatal error:  Call to undefined function get_current_screen() in /Library/WebServer/Documents/reactorshop/wp-content/plugins/wp-e-commerce/wpsc-admin/includes/product-functions.php on line 23, referer: http://www.reactorshop.loc/wp-admin/network/update.php?action=update-selected&plugins=polylang%2Fpolylang.php&_wpnonce=a8091df463
    PHP Stack trace:, referer: http://www.reactorshop.loc/wp-admin/network/update.php?action=update-selected&plugins=polylang%2Fpolylang.php&_wpnonce=a8091df463
    PHP   1. {main}() /Library/WebServer/Documents/reactorshop/wp-admin/network/plugins.php:0, referer: http://www.reactorshop.loc/wp-admin/network/update.php?action=update-selected&plugins=polylang%2Fpolylang.php&_wpnonce=a8091df463
    PHP   2. require_once() /Library/WebServer/Documents/reactorshop/wp-admin/network/plugins.php:11, referer: http://www.reactorshop.loc/wp-admin/network/update.php?action=update-selected&plugins=polylang%2Fpolylang.php&_wpnonce=a8091df463
    PHP   3. require_once() /Library/WebServer/Documents/reactorshop/wp-admin/network/admin.php:13, referer: http://www.reactorshop.loc/wp-admin/network/update.php?action=update-selected&plugins=polylang%2Fpolylang.php&_wpnonce=a8091df463
    PHP   4. require_once() /Library/WebServer/Documents/reactorshop/wp-admin/admin.php:30, referer: http://www.reactorshop.loc/wp-admin/network/update.php?action=update-selected&plugins=polylang%2Fpolylang.php&_wpnonce=a8091df463
    PHP   5. require_once() /Library/WebServer/Documents/reactorshop/wp-load.php:29, referer: http://www.reactorshop.loc/wp-admin/network/update.php?action=update-selected&plugins=polylang%2Fpolylang.php&_wpnonce=a8091df463
    PHP   6. require_once() /Library/WebServer/Documents/reactorshop/wp-config.php:104, referer: http://www.reactorshop.loc/wp-admin/network/update.php?action=update-selected&plugins=polylang%2Fpolylang.php&_wpnonce=a8091df463
    PHP   7. do_action($tag = *uninitialized*, $arg = *uninitialized*) /Library/WebServer/Documents/reactorshop/wp-settings.php:361, referer: http://www.reactorshop.loc/wp-admin/network/update.php?action=update-selected&plugins=polylang%2Fpolylang.php&_wpnonce=a8091df463
    PHP   8. call_user_func_array(*uninitialized*, *uninitialized*) /Library/WebServer/Documents/reactorshop/wp-includes/plugin.php:429, referer: http://www.reactorshop.loc/wp-admin/network/update.php?action=update-selected&plugins=polylang%2Fpolylang.php&_wpnonce=a8091df463
    PHP   9. PLL_Upgrade->wp_loaded_upgrade_1_2_1(*uninitialized*) /Library/WebServer/Documents/reactorshop/wp-includes/plugin.php:429, referer: http://www.reactorshop.loc/wp-admin/network/update.php?action=update-selected&plugins=polylang%2Fpolylang.php&_wpnonce=a8091df463
    PHP  10. PLL_MO->export_to_db($lang = *uninitialized*) /Library/WebServer/Documents/reactorshop/wp-content/plugins/polylang/include/upgrade.php:348, referer: http://www.reactorshop.loc/wp-admin/network/update.php?action=update-selected&plugins=polylang%2Fpolylang.php&_wpnonce=a8091df463
    PHP  11. wp_insert_post($postarr = *uninitialized*, $wp_error = *uninitialized*) /Library/WebServer/Documents/reactorshop/wp-content/plugins/polylang/include/mo.php:43, referer: http://www.reactorshop.loc/wp-admin/network/update.php?action=update-selected&plugins=polylang%2Fpolylang.php&_wpnonce=a8091df463
    PHP  12. do_action($tag = *uninitialized*, $arg = *uninitialized*, *uninitialized*, *uninitialized*) /Library/WebServer/Documents/reactorshop/wp-includes/post.php:2954, referer: http://www.reactorshop.loc/wp-admin/network/update.php?action=update-selected&plugins=polylang%2Fpolylang.php&_wpnonce=a8091df463
    PHP  13. call_user_func_array(*uninitialized*, *uninitialized*) /Library/WebServer/Documents/reactorshop/wp-includes/plugin.php:429, referer: http://www.reactorshop.loc/wp-admin/network/update.php?action=update-selected&plugins=polylang%2Fpolylang.php&_wpnonce=a8091df463
    PHP  14. wpsc_admin_submit_product($post_ID = *uninitialized*, $post = *uninitialized*) /Library/WebServer/Documents/reactorshop/wp-includes/plugin.php:429, referer: http://www.reactorshop.loc/wp-admin/network/update.php?action=update-selected&plugins=polylang%2Fpolylang.php&_wpnonce=a8091df463

    It's not a show stopper for me, since I'm still using Polylang 1.1.6 at the server, and quickly reverted the upgrade modifications in my development environment, so I can wait.

    Thank you, Chouby!

    http://wordpress.org/plugins/polylang/

  2. Chouby
    Member
    Plugin Author

    Posted 9 months ago #

    This get_current_screen() function is terrific. Everybody (including me) assumes it is always available... when it is defined quite late. Let's try to delay the update a bit later (after get_current_screen is defined).

    Could you go in polylang/include/upgrade.php at line 329 and replace

    add_action('wp_loaded', array(&$this, 'wp_loaded_upgrade_1_2_1')); // once wp-rewrite is available
    
    if (did_action('wp_loaded'))
    	$this->wp_loaded_upgrade_1_2_1();

    by

    add_action('admin_init', array(&$this, 'wp_loaded_upgrade_1_2_1')); // once wp-rewrite is available
    
    if (did_action('admin_init'))
    	$this->wp_loaded_upgrade_1_2_1();
  3. ReactorShop
    Member
    Posted 9 months ago #

    Yep, that solved it!

    Thank you, Chouby!

  4. Chouby
    Member
    Plugin Author

    Posted 9 months ago #

    OK thanks. I'll include it in the next release.

Reply

You must log in to post.

About this Plugin

About this Topic