Support

Home Forums Event Espresso Premium wpdb::prepare was called incorrectly

wpdb::prepare was called incorrectly

Posted: August 21, 2014 at 9:18 am

Viewing 1 reply thread


Jeff Porter

August 21, 2014 at 9:18 am

I have seen this a lot in this forum, but we have just ran into it ourselves.

Event Espresso version 3.1.36.5.P
WordPress version WP 3.9.2

This message on all event pages:
Notice: wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder. Please see Debugging in WordPress for more information. (This message was added in version 3.9.) in /var/www/vhosts/tickets.handbid.com/wp-includes/functions.php on line 3245

Some input from one of my developers:

this seems to be how that particular one that is erroring expands –

SELECT e.*, ese.start_time, ese.end_time , v.name venue_name, v.address venue_address, v.address2 venue_address2, v.city venue_city, v.state venue_state, v.zip venue_zip, v.country venue_country, v.meta venue_meta FROM wp_events_detail e LEFT JOIN wp_events_start_end ese ON ese.event_id = e.id LEFT JOIN wp_events_venue_rel r ON r.event_id = e.id LEFT JOIN wp_events_ve
nue v ON v.id = r.venue_id WHERE e.is_active=’Y’ AND e.event_status != ‘D’ AND e.id = ‘3’ LIMIT 0,1

this particular query they seem to take whats passed in as ee and itnval it or cast it – because when I pass a string it ends up as ‘0’

so its getting escaped somewhere

[0] => SELECT e.* FROM wp_events_detail e LEFT JOIN wp_events_start_end ese ON ese.event_id = e.id WHERE post_id = ‘panda\’express’ LIMIT 0,1

I dont know how it’d being escaped (like what functions being used, etc) but in practice you should use prepare properly, and use place holders and pass in your values to the prepare function so it can ensure its a proper prepared query because if they don’t, this will whine and bitch every time. I’m not sure if the query event gets ran or if wp is refusing to run it

it’d probably be enough to give them the error, the file (event-espresso/includes/functions/main.php) and the line – 308


Tony

  • Support Staff

August 21, 2014 at 10:01 am

Hi Jeff,

Thank you for the feedback, this has been fixed in the next version of Event Espresso.

The warning should only be visible when WP_Debug is enabled. It is advisable to not use WP_Debug on productions sites, or if you would like to review the errors, log them rather than display using something like:

define( 'WP_DEBUG', true ); // Or false
if ( WP_DEBUG ) {
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', false );
    @ini_set( 'display_errors', 0 );
}
Viewing 1 reply thread

The support post ‘wpdb::prepare was called incorrectly’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso