Fixed Mysqli statement execute error : Column 'old_value' cannot be null

Chris D

XenForo developer
Staff member
This error could be thrown as a result of the user change logging where a column is added to a xf_user_* table that has a default value of NULL.

As soon as the DataWriter changes that value, this error will be thrown by the change logging system when it attempts to write the NULL to the old_value field.

It can be worked around (the only cases where I see this being a problem in my add-ons can be solved actually by excluding these from the change logging) but it might be better to catch this in the code and convert it to an empty string or 0 or allow NULL for that field.
 
Last edited:
Fixed this now by forcing strings (which treats null the same as an empty string). This is obviously debatable and it's possible that a null value is actually desirable here. I'm thinking that this is generally focused on user visible changes so this approach is acceptable.
 
Got this error a few times already since beta 1 when I manually upgraded a member to a custom usergroup. I thought it has something to do my custom addons but hope this can be fixed for once in beta 3.
 
FYI, it is add-on related -- the change will stop the error for an add-on that doesn't update anything, but the add-on will still have the changes potentially logged (which may or may not be desirable).
 
Back
Top Bottom