NPFchan
NPFchan copied to clipboard
Whitelist API broken in Bans::new_ban
- How to reproduce: trigger
new_ban
an IP - Error msg:
Illegal mix of collations (ascii_general_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation '='
In Bans::new_ban:
https://github.com/fallenPineapple/NPFchan/blob/a991b6872e7bc6c527a4fcbf6a44d7515d053659/inc/bans.php#L619
an inet_pton format address is passed to Whitelist::remove_user, while this mismatches the datatype declared in install.sql and causes the collation mismatch.
It is easy to workaround when $mask is an IP address, but it seems like the whitelist table is not designed for a IP range query, not sure if there is any better way to resolve the subnet/range case.