• Resolved Diblo Dk

    (@diblo)


    I am having trouble with CFDB7 does not mark all messages as read.
    The problem occurs both when a message has been read or when I use bulk read and unread.

    My current installation
    WordPress version 4.8.2
    Contact Form 7 version 4.8.1
    Contact Form CFDB7 version 1.1.4

    The php error log

    [26-Oct-2017 21:56:07 UTC] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't figure out how to attach) ";}' WHERE form_id = '192'' at line 1 for query UPDATE wp_db7_forms SET form_value = 'a:5:{s:12:"cfdb7_status";s:6:"unread";s:9:
    [...]
    photos, but can't figure out how to attach) ";}' WHERE form_id = '192' made by do_action('toplevel_page_cfdb7-list'), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, Cfdb7_Wp_Main_Page->list_table_page, Cfdb7_Wp_Sub_Page->__construct, Cfdb7_Wp_Sub_Page->list_table_page, CFDB7_List_Table->prepare_items, CFDB7_List_Table->process_bulk_action

    The errors occur in the mysql when a quote is appear in the serialise string.

    Patch
    I have patched my files by adding this line (below) to the file inc/admin-form-details.php at line 80 and to the file inc/admin-subpage.php at line 315 and again at line 332 after the insert at line 315.
    $form_data = mysql_real_escape_string( $form_data );

    This affects mysql update in the methods form_details_page and process_bulk_action so the serialise string is escaped for the mysql.

    • This topic was modified 7 years, 5 months ago by Diblo Dk.
    • This topic was modified 7 years, 5 months ago by Diblo Dk.
    • This topic was modified 7 years, 5 months ago by Diblo Dk.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Arshid

    (@arshidkv12)

    mysql_real_escape_string will make trouble in WordPress. Please use esc_sql function.

    Thread Starter Diblo Dk

    (@diblo)

    Thanks ??

    Hello,

    I have the same issue,

    I believe it comes from the sterilization as the op mentioned. I would add that the issue is present when i have checkboxes in the form (for me at least).

    Checkboxes are serialized as arrays and I think that this causes the issue we face here.

    Please advise or provide a fix for this

    Thanks

    Plugin Author Arshid

    (@arshidkv12)

    What is error message?

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ...";}}' WHERE fo' at line 2]

    I believe this is because checkbox are saved as array and you then have an array to string conversion.

    This happens when you click on message and it tries to update the read status messing with the serialization

    Plugin Author Arshid

    (@arshidkv12)

    What are the checkbox values?

    well in my case it’s a long sentence containing single quotes. it’s a “I confirm to be emailed back” checkbox

    Plugin Author Arshid

    (@arshidkv12)

    Please add following code in inc/admin-subpage.php after line 315, 332 and inc/admin-form-details.php at line 80.
    $form_data = serialize( $result_values );

    $form_data = esc_sql($form_data);

    adding $form_data = esc_sql($form_data); to inc/admin-form-details.php at line 80

    seem to have fixed it. but I’m not sure about lines 315, and 332 from inc/admin-subpage.php. are you sure the patch is needed there too?

    Thread Starter Diblo Dk

    (@diblo)

    If you are using CFDB7 version 1.1.6, you should add the code to inc/admin-subpage.php after line 318 and 335.

    • This reply was modified 7 years, 3 months ago by Diblo Dk.
    • This reply was modified 7 years, 3 months ago by Diblo Dk.
    • This reply was modified 7 years, 3 months ago by Diblo Dk.
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘CFDB7 does not mark all messages as read’ is closed to new replies.