• Resolved leedxw

    (@leedxw)


    I recently looked into a page that was truncating at the point of table display, and the associated chart data could not be edited in the admin interface due to an error.

    I found this was caused by a column having an empty display header. It looks like the code is using the header name as a key, but in the case of an empty header, the key was empty.

    PHP Warning:  Undefined array key "" in /var/www/html/wp-content/plugins/wpdatatables/source/class.wpdatatable.php on line 1400

    This then triggers a fatal error in prepareRenderingRules() stack trace below, although the line numbers are wrong because I’d added some error_log entries for debugging.

    PHP Fatal error:  Uncaught Error: Call to a member function setFilterType() on false in /var/www/html/wp-content/plugins/wpdatatables/source/class.wpdatatable.php:2536
    Stack trace:
    #0 /var/www/html/wp-content/plugins/wpdatatables/source/class.wpdatatable.php(2514): WPDataTable->prepareRenderingRules()
    #1 /var/www/html/wp-content/plugins/wpdatatables/source/class.wpdatatable.php(3092): WPDataTable->fillFromData()
    #2 /var/www/html/wp-content/plugins/wpdatatables/source/class.wpdatachart.php(485): WPDataTable::loadWpDataTable()
    #3 /var/www/html/wp-content/plugins/wpdatatables/source/class.wpdatachart.php(1024): WPDataChart->loadChildWPDataTable()
    #4 /var/www/html/wp-content/plugins/wpdatatables/source/class.google.wpdatachart.php(388): WPDataChart->loadFromDB() ...

    I’d resolved the issue by manually adding column names using SQL

    UPDATE wp_wpdatatables_columns SET orig_header="untitled" WHERE id=124;
    UPDATE wp_wpdatatables_columns SET display_header="untitled" WHERE id=124;
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Milos Jovanovic

    (@milosjovanovicwpdt)

    Hello,

    Firstly, my apologies for the delayed reply and thank you for your patience.

    Regarding the issue you described: I want to make sure we fully understand the sequence of events. From what you wrote, it seems some of the columns used in the chart had empty header names, which then caused the chart to break.

    Normally, this is the expected/default behavior in wpDataTables. For example:

    • If you create a table where all columns have valid header names, you can generate a chart from it without issue.
    • But later, if the column structure of the source table is changed (e.g. renaming headers — especially ones used in the chart, reordering columns, or deleting columns), the chart will break. In such cases, the solution is usually to recreate the chart from the updated table.

    That’s why I’d like to clarify a couple of points:

    1. Did the table originally have proper column headers when you first created the chart?
    2. Were any changes later made to the table structure (header names, order, or column deletion) before the error appeared?

    If we know exactly what changed, we’ll be able to confirm whether this is an actual bug that needs to be resolved, or if it’s simply the intended/default behavior when a table’s structure no longer matches the chart definition.

    Kind regards,
    Milos

    Thread Starter leedxw

    (@leedxw)

    I’m afraid I can’t answer these questions as it’s not a site I manage – I was asked to look at a page that was broken on a website, and determined that empty table headers were the cause.

    Thread Starter leedxw

    (@leedxw)

    I would suggest that any error that requires resource to direct database manipulation to fix, shouldn’t be regarded as intended behaviour.

    Plugin Support Milos Jovanovic

    (@milosjovanovicwpdt)

    Hello again,

    Thanks for clarifying.

    We’ve tried to reproduce this on our test sites, but we haven’t been able to. The plugin does not create empty headers by itself — if a column header was missing, this would usually be the result of a user action or change in the table structure.

    As long as the table is created with valid headers and no structural changes are made afterwards, both tables and charts function normally (per our documentation). Without knowing the exact steps or history of how the table and chart were configured on the site in question, we can’t declare this as a bug, since there’s no reproducible case for our developers to investigate.

    Based on your description, it seems most likely that the column structure of the table changed after the chart was created — for example:

    • Renaming or deleting a column used in the chart
    • Reordering columns
    • Or leaving a header blank after editing

    Since you’ve resolved the immediate issue by editing the database directly, we can consider this specific case closed. If it happens again, a quick test would be to create a new chart from the same table. If that new chart works without errors, it’s a strong indication that the original chart broke because of changes in the table’s column structure.

    I hope this helps clarify, and we’ll be here if you or the site manager encounter any other issues.

    Kind regards,
    Milos

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Fatal error caused by untitled column’ is closed to new replies.