In og.module, OG_STATE_* are defined as integers. However, in the {og_membership} table, the state is stored as a string. This breaks anywhere that does strict comparisons (like === FALSE vs a potential custom state of 0). This also complicates code that exports a membership after assigning state that isn't directly loaded from the database. For example, a JSON export of a membership would be a string if loaded from the database, but an int if set from a constant.

According to the git logs, this property used to be a field, which might explain why it's a varchar. I wanted to be sure before submitting a patch that there wasn't some edge use case for this. Otherwise, I think it makes sense to redefine and update the field to a tinyint.

Comments

amitaibu’s picture

Indeed, OG state is an integer (1 - 3)
Instead of patch, try a PR :)