Please upgrade here. These earlier versions are no longer being updated and have security issues.

GDN_Log Error Regarding IP Address Encoding when Editing Post [RESOLVED]

edited March 2018 in Vanilla 2.0 - 2.8

After upgrading from 2.3.1 to 2.5.1, I am receiving the following error message when trying to edit a post.

{ "Code": 256, "Exception": "Incorrect string value: '\\xB9s' for column 'InsertIPAddress' at row 1|Gdn_Database|Query|insert GDN_Log \n(`Operation`, `RecordType`, `RecordID`, `RecordUserID`, `RecordIPAddress`, `RecordDate`, `InsertUserID`, `InsertIPAddress`, `DateInserted`, `ParentRecordID`, `CategoryID`, `OtherUserIDs`, `Data`) \nvalues (:Operation, :RecordType, :RecordID, :RecordUserID, :RecordIPAddress, :RecordDate, :InsertUserID, :InsertIPAddress, :DateInserted, :ParentRecordID, :CategoryID, :OtherUserIDs, :Data)", "Class": "Gdn_ErrorException" }

A further investigation on the database shows lots of similar formatted IP addresses associated with logs in GDN_Log. Some IP addresses such as [email protected]~- as well as G:J~ appear blended with other traditional xxx.xxx.xxx.xxx IP addresses. Those weird IP addresses immediately directed me towards the probable cause of incorrect encoding/decoding with Vanilla database, that some lucky IP addresses sneak through with the encoding character luckily fall within the ASCII range, while others such as the one shown above in the error message was not so lucky and got rejected. Given that one of the most important change in 2.5 is the introduction of new method to encode/decode IP addresses before saving them to database, I am expecting this to be the reason why I can no longer save my post.

This also pointed me of the probable cause of an improperly completed upgrade process. However I did follow the instruction to access the update page twice and even more, and the problem persists. Removing every rows in GDN_Log also did not solve the problem. Please advise on where else I am missing, as well as if there would be any quick fix/correction that could get my forum back to normal operation.

Comments

  • The problem have been pinpointed to the wrong schema for the GDN_Log Table. In the old format, the InsertIPAddress has a type of varchar(15). A closer look at the schema of GDN_UserIP suggest that it should be of the type varbinary(16). Changing the schema of the GDN_Log accordingly fixes the problem.

    Please mark this post as [RESOLVED]

Sign In or Register to comment.