#4654 closed defect (bug) (fixed)
incorrect usage of $wpdb->prepare()
Reported by: | anointed | Owned by: | |
---|---|---|---|
Milestone: | 1.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Core | Keywords: | |
Cc: | cklosowski@… |
Description
Keeping an eye out on my log files for warnings about prepare. I will continue appending new ones as they show up in my log files
1st one:
argument 2 for wpdb::prepare(), called in /wp-content/plugins/buddypress/bp-messages/bp-messages-classes.php on line 558
Change History (31)
#2
@
12 years ago
#3 activity-classes
Missing argument 2 for wpdb::prepare(), called in /wp-content/plugins/buddypress/bp-activity/bp-activity-classes.php on line 219
#3
@
12 years ago
#4 activity-classes
Missing argument 2 for wpdb::prepare(), called in /wp-content/plugins/buddypress/bp-activity/bp-activity-classes.php on line 231
#4
@
12 years ago
#5 activity-classes line 236, 239
Missing argument 2 for wpdb::prepare(), called in /wp-content/plugins/buddypress/bp-activity/bp-activity-classes.php on line 236
mod_fcgid: stderr: PHP Warning: Missing argument 2 for wpdb::prepare(), called in /buddypress/bp-activity/bp-activity-classes.php on line 239
#5
@
12 years ago
#6 activity-classes
Missing argument 2 for wpdb::prepare(), called in /wp-content/plugins/buddypress/bp-activity/bp-activity-classes.php on line 250
#6
@
12 years ago
#7 friends-classes
Missing argument 2 for wpdb::prepare(), called in /wp-content/plugins/buddypress/bp-friends/bp-friends-classes.php on line 90
#7
@
12 years ago
#8 #9 #10 bp-blogs-classes Line 116, 117, 296
mod_fcgid: stderr: PHP Warning: Missing argument 2 for wpdb::prepare(), called in /wp-content/plugins/buddypress/bp-blogs/bp-blogs-classes.php on line 116
mod_fcgid: stderr: PHP Warning: Missing argument 2 for wpdb::prepare(), called in /wp-content/plugins/buddypress/bp-blogs/bp-blogs-classes.php on line 117
mod_fcgid: stderr: PHP Warning: Missing argument 2 for wpdb::prepare(), called in /wp-content/plugins/buddypress/bp-blogs/bp-blogs-classes.php on line 296
#8
@
12 years ago
bp-xprofile line 139, 173, 333
mod_fcgid: stderr: PHP Warning: Missing argument 2 for wpdb::prepare(), called in /buddypress/bp-xprofile/bp-xprofile-classes.php on line 139
Missing argument 2 for wpdb::prepare(), called in /buddypress/bp-xprofile/bp-xprofile-classes.php on line 173
Missing argument 2 for wpdb::prepare(), called in /buddypress/bp-xprofile/bp-xprofile-classes.php on line 333
#9
@
12 years ago
- Component changed from Core to All Components
- Milestone changed from Awaiting Review to 1.7
#12
@
12 years ago
(In [6499]) Remove more unneeded prepare() calls on the BuddyPress admin screen. See #4654
#14
@
12 years ago
Here are 3 that popped up for me on a fresh WordPress 3.5 beta 2 install and svn checkout of BuddyPress on 2012-11-12 ~12:00PM:
---
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-core\bp-core-functions.php on line 176 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-core\bp-core-options.php on line 296 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-core\admin\bp-core-functions.php on line 220 and defined in \wordpress\wp-includes\wp-db.php on line 990
---
#15
@
12 years ago
Others from front-end:
---
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-groups\bp-groups-classes.php on line 674 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-core\bp-core-classes.php on line 355 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-xprofile\bp-xprofile-filters.php on line 237 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-activity\bp-activity-classes.php on line 219 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-activity\bp-activity-classes.php on line 231 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-activity\bp-activity-classes.php on line 236 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-friends\bp-friends-classes.php on line 88 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-friends\bp-friends-classes.php on line 90 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-friends\bp-friends-classes.php on line 94 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-xprofile\bp-xprofile-classes.php on line 139 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-xprofile\bp-xprofile-classes.php on line 333 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-xprofile\bp-xprofile-classes.php on line 173 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-xprofile\bp-xprofile-classes.php on line 136 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-xprofile\bp-xprofile-classes.php on line 141 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-xprofile\bp-xprofile-classes.php on line 167 and defined in \wordpress\wp-includes\wp-db.php on line 990
---
#16
@
12 years ago
These 4 popped up in admin groups page:
---
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-groups\bp-groups-classes.php on line 761 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-groups\bp-groups-classes.php on line 762 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-groups\bp-groups-classes.php on line 763 and defined in \wordpress\wp-includes\wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in \wordpress\wp-content\plugins\buddypress\bp-groups\bp-groups-classes.php on line 764 and defined in \wordpress\wp-includes\wp-db.php on line 990
---
#17
@
12 years ago
For visitors reading this, the workaround/fix for these is to remove the $wpdb->prepare(); function that only has 1 string argument, for example, on line 94 of \wordpress\wp-content\plugins\buddypress\bp-friends\bp-friends-classes.php:
$friends = $wpdb->get_results( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} $friend_sql $oc_sql ORDER BY date_created DESC" ) );
BECOMES:
$friends = $wpdb->get_results( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} $friend_sql $oc_sql ORDER BY date_created DESC" );
---
Thanks -- Marty McGee (companyjuice)
#20
@
12 years ago
Warning: Missing argument 2 for wpdb::prepare(), called in /home/nexialys/public_html/core/wp-content/plugins/buddypress/bp-core/bp-core-functions.php on line 176 and defined in /home/nexialys/public_html/core/wp-includes/wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in /home/nexialys/public_html/core/wp-content/plugins/buddypress/bp-core/bp-core-options.php on line 296 and defined in /home/nexialys/public_html/core/wp-includes/wp-db.php on line 990
Warning: Missing argument 2 for wpdb::prepare(), called in /home/nexialys/public_html/core/wp-content/plugins/buddypress/bp-core/admin/bp-core-functions.php on line 217 and defined in /home/nexialys/public_html/core/wp-includes/wp-db.php on line 990
########
btw, just add $args = "" in the proper line 990 in wp-db.php would avoid all these alerts with no problem...
#27
@
12 years ago
- Resolution set to fixed
- Status changed from new to closed
Looks all fixed up to me. Closing as fixed.
#28
@
12 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
- Fresh install, with (current) trunk
- custom profile fields.
- add details to the profile field and change the visibility to, for example 'friends only'.
- log out and view profile.
- profit:
[07-Feb-2013 08:07:31] PHP Notice: wpdb::prepare was called <strong>incorrectly</strong>. wpdb::prepare() requires at least two arguments. Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information. (This message was added in version 3.5.) in wp-includes/functions.php on line 2959
From a quick glance, I'm pretty sure it's the exclude_fields_sql http://buddypress.trac.wordpress.org/browser/trunk/bp-xprofile/bp-xprofile-classes.php#L167 but don't have time to look into it at the moment.
#2-friends-classes