Skip to:
Content

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#1999 closed defect (bug) (fixed)

"There was a problem posting your update, please try again." when running MySQL in Strict Mode

Reported by: Zooney Owned by:
Milestone: 1.2.2 Priority: critical
Severity: Version:
Component: Activity Keywords: strict mode, mysql has-patch needs-testing
Cc: Zooney, marcus@…

Description

I get the message: "There was a problem posting your update, please try again." in a red box (in the new default theme) every time I attempt to post an update.

Steps to reproduce:

1.) Go to My Account->Activity->Personal type a message into the "What's new ..." box and hit Post Update

Versions:
Wordpress 2.9.1
BuddyPress 1.2

Attachments (1)

1999.001.diff (1.2 KB) - added by cnorris23 4 years ago.

Download all attachments as: .zip

Change History (15)

comment:1 Zooney4 years ago

I've managed to track down the cause of this issue.

This issue occurs when MySQL is running in strict mode (i.e. sql_mode="STRICT_TRANS_TABLES,...")

I'm not certain if BuddyPress supports MySQL in strict mode.

If it doesn't, this probably can be qualified as expected behavior.

If BuddyPress is supposed to support strict mode, there must be some bug in which improperly formed data is being submitted to the database when updates are being posted.

comment:2 Zooney4 years ago

  • Summary changed from "There was a problem posting your update, please try again." to "There was a problem posting your update, please try again." when running MySQL in Strict Mode

comment:3 Zooney4 years ago

On attempting to post "Sooper dooper" into the activity box for an account called 'admin' I ended up with the following PHP error in my error log:

php[1524]
WordPress database error Field 'mptt_left' doesn't have a default value for query INSERT INTO wp_bp_activity ( user_id, component, type, action, content, primary_link, date_recorded, item_id, secondary_item_id, hide_sitewide ) VALUES ( 1, 'activity', 'activity_update', '<a href=\"http://localhost.localdomain/BuddyPress/members/admin/\" title=\"admin\">admin</a> posted an update:', 'Sooper dooper', 'http://localhost.localdomain/BuddyPress/members/admin/', '2010-02-23 21:35:11', , , 0 ) made b

comment:4 Zooney4 years ago

  • Milestone set to 1.2.2

comment:5 Zooney4 years ago

  • Keywords strict mode mysql added

comment:6 Zooney4 years ago

I just noticed that the complete error text was cut off in the system log. The full error for user 'admin' posting 'Update.' looks like this:

[24-Feb-2010 14:23:43] WordPress database error Field 'mptt_left' doesn't have a default value for query INSERT INTO wp_bp_activity ( user_id, component, type, action, content, primary_link, date_recorded, item_id, secondary_item_id, hide_sitewide ) VALUES ( 1, 'activity', 'activity_update', '<a href=\"http://localhost.localdomain/BuddyPress/members/admin/\" title=\"admin\">admin</a> posted an update:', 'Update.', 'http://localhost.localdomain/BuddyPress/members/admin/', '2010-02-24 14:23:43', , , 0 ) made by require_once, require_once, do_action, call_user_func_array, bp_core_add_ajax_hook, do_action, call_user_func_array, bp_dtheme_post_update, bp_activity_post_update, bp_activity_add, BP_Activity_Activity->save

comment:7 in reply to: ↑ description nickbwatson4 years ago

  • Priority changed from major to critical

I'm getting this error as well, I really would like this fixed as soon as possible.

comment:8 in reply to: ↑ description nickbwatson4 years ago

I don't know if this helps you at all, but I'm sure I figured out exactly WHEN the error occurs.

If you have any selection boxes (checkboxes, radio buttons, drop boxes) that don't have a selection in them, you will receive the error. SO as long as you select an option in each selection field, you won't get the error.

This occurs even if the fields aren't "required". I tried this on just a normal text box, and it works fine (no error). It's only selections. It's as if it's treating all the selection fields as if they are required.

I hope that helped.

comment:9 netweblogic4 years ago

  • Cc marcus@… added

I get this too.

Fix can be done either in the code SQL statements by adding inserts for mptt left and righ, or just editing the SQL.

To fix it on the current 1.2.x releases:
ALTER TABLE wp_bp_activity CHANGE mptt_left mptt_left INT( 11 ) NOT NULL DEFAULT '0',
CHANGE mptt_right mptt_right INT( 11 ) NOT NULL DEFAULT '0'

To fix it for future BP release:
bp-activity.php replace lines 47-48 with :

mptt_left int(11) NOT NULL DEFAULT '0',
mptt_right int(11) NOT NULL DEFAULT '0',

Sorry, don't use SVN much so couldn't generate a patch... must learn to do that actually....

comment:10 follow-up: cnorris234 years ago

  • Keywords has-patch needs-testing added

A patch has been added. I'm not having this issue, so those of you with the problem will need to test this. The patch updates any strict mode incompatible tables already created, or properly creates them, in the case of a fresh install, based on netweblogic's information.

cnorris234 years ago

comment:11 in reply to: ↑ 10 netweblogic4 years ago

Replying to cnorris23:

A patch has been added. I'm not having this issue, so those of you with the problem will need to test this. The patch updates any strict mode incompatible tables already created, or properly creates them, in the case of a fresh install, based on netweblogic's information.

thanks cnorris23, looks good to me.

comment:12 Zooney4 years ago

It works.

Thank you!

comment:13 apeatling4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [2838]) Fixes #1999

comment:14 apeatling4 years ago

  • Component set to Activity
  • Milestone changed from 1.2.3 to 1.2.2
Note: See TracTickets for help on using tickets.