• Toni Viemer?

    (@skithund)


    After upgrading TablePress to 3.0, first page reload apparently tries to convert existing tables/datatables from v1 to v2.

    If/when datatables_custom_commands array key is missing, you’ll get a TypeError fatal error during conversion, because TablePress::convert_datatables_api_data() is expecting a string, nut a null value. This only happens once after plugin upgrade, but is reproducable, when pulling production data with TablePress 2.4.4 and upgrading to 3.0. This happens at least with PHP 8.3. Not sure about previous versions if they’re so strict about types.

    If you need more info, happy to provide.

    Full error:

    [21-Nov-2024 11:24:46 UTC] PHP Warning:  Undefined array key "datatables_custom_commands" in /app/wordpress/wp-content/plugins/tablepress/models/model-table.php on line 1089
    [21-Nov-2024 11:24:46 UTC] PHP Fatal error: Uncaught TypeError: TablePress::convert_datatables_api_data(): Argument #1 ($code) must be of type string, null given, called in /app/wordpress/wp-content/plugins/tablepress/models/model-table.php on line 1089 and defined in /app/wordpress/wp-content/plugins/tablepress/classes/class-tablepress.php:620
    Stack trace:
    #0 /app/wordpress/wp-content/plugins/tablepress/models/model-table.php(1089): TablePress::convert_datatables_api_data(NULL)
    #1 /app/wordpress/wp-content/plugins/tablepress/classes/class-controller.php(123): TablePress_Table_Model->update_custom_commands_datatables_tp30()
    #2 /app/wordpress/wp-content/plugins/tablepress/classes/class-controller.php(31): TablePress_Controller->plugin_update_check()
    #3 /app/wordpress/wp-content/plugins/tablepress/controllers/controller-admin.php(54): TablePress_Controller->__construct()
    #4 /app/wordpress/wp-content/plugins/tablepress/classes/class-tablepress.php(228): TablePress_Admin_Controller->__construct(NULL)
    #5 /app/wordpress/wp-content/plugins/tablepress/classes/class-tablepress.php(281): TablePress::load_class('TablePress_Admi...', 'controller-admi...', 'controllers')
    #6 /app/wordpress/wp-content/plugins/tablepress/classes/class-tablepress.php(159): TablePress::load_controller('admin')
    #7 /app/wordpress/wp-includes/class-wp-hook.php(324): TablePress::run('')
    #8 /app/wordpress/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
    #9 /app/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #10 /app/wordpress/wp-settings.php(704): do_action('init')
    #11 /app/wordpress/wp-config.php(152): require_once('/app/wordpress/...')
    #12 /app/wordpress/wp-load.php(50): require_once('/app/wordpress/...')
    #13 /app/wordpress/wp-admin/admin.php(34): require_once('/app/wordpress/...')
    #14 /app/wordpress/wp-admin/index.php(10): require_once('/app/wordpress/...')
    #15 {main}
    thrown in /app/wordpress/wp-content/plugins/tablepress/classes/class-tablepress.php on line 620
Viewing 1 replies (of 1 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi @skithund!

    Thanks for letting me know about this! I’m not really sure how the datatables_custom_commands array key can be missing (because it’s part of the default table structure) but it definitely can’t hurt to add some protection here!

    I think I can simply add another isset() check here. I will release that as part of an update shortly!

    Best wishes,
    Tobias

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.