Support » Plugin: PTA Volunteer Sign Up Sheets » Notice: wpdb::prepare was called incorrectly.

  • Resolved askpivot

    (@askpivot)


    At this page in the backend: wp-admin/admin.php?page=pta-sus-settings_sheets, and the “Current Volunteer Opportunities” list on the front end, this PHP notice is displaying: “Notice: wpdb::prepare was called incorrectly. The query does not contain the correct number of placeholders (1) for the number of arguments passed (2). Please see Debugging in WordPress for more information. (This message was added in version 4.8.3.) in /home/simplead/public_html/wp-includes/functions.php on line 4139”

    I assume we aren’t the only users to experience this, and I imagine this will need to be resolved going forward since WordPress released their latest 4.8.3 security fix.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Also, the errors seem to stem from this file: /pta-volunteer-sign-up-sheets/classes/data.php. Thank you!

    Plugin Author DBAR Productions

    (@dbar-productions)

    Thanks for letting me know. I will take a look and push out an update soon. You are the first to report this. Perhaps something changed in the latest WP version that is giving these notices (NOT errors, just notices… not a security issue, and won’t break anything). There were no such notices when I released the last update.

    Plugin Author DBAR Productions

    (@dbar-productions)

    Apparently, they decided to add that notice in WP 4.8.3 even if you are just passing an extra unused parameter to the prepare function (previously, was not an issue). Depending on how those functions in my plugin were called, sometimes the date was used as a parameter in the SQL query (via a placeholder for security), and sometimes it was not needed. The date part of the query was conditionally added only when needed (getting expired tasks, or only current sheets, etc.), but just one prepare statement was used with all possible parameters, with the date being the last one because it is often not used. I guess they are going to give us a notice about that now, which means more code to conditionally check if the date is used and to create two different prepare statements.

    That will be pushed out in an update soon. Please note that this is not an error, just a notice, and is NOT a security risk nor will it break anything in the plugin. There was simply an extra unused parameter passed to the prepare functions, which WordPress used to previously ignore if it wasn’t needed (only 2 placeholders, but 3 parameters passed in). Just need to test all the pages that use different queries to make sure I got them all (there are several).

    Thank you for the prompt response, your explanation makes great sense. We look forward to the update!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Notice: wpdb::prepare was called incorrectly.’ is closed to new replies.