News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Custom fields data corruption?

Started by mpglivecarlo, May 31, 2012, 02:08:27 AM

Previous topic - Next topic

mpglivecarlo

Hi,

I have a forum on SMF V 2.0.2 and i have created some new custom fields that must be filled upon registration and i dont know why this has happened but 2 fields that where configured to be in the custom mask as numeric got "corrupted" information. User registered a long digit number like a phone number and after a while the number in DB was turned into 2147483647.

I have searched the forums to see if there is something wrong on the configuration but havent found the number linked to any custom filed error.

Please help because i am loosing this information because it gets replaced or wrongly stored in the mysql DB.

thanks

live627

2147483647 is the max value for a 32 bit signed int. This is actually a hardware limitation, capped by the 32 bit architecture.

In your case, since you are pushing gigantic numbers through the system, casting the input to an integer won't help. Instead, treat it as a string. Set the input mask to regex ((regular expression) and use the following:

/^\s*([0-9]+)\s*$/

That will emulate a number. Only digits 0-9 are accepted. Untested. And this change will leave all existing data intact.

mpglivecarlo

Quote from: live627 on May 31, 2012, 03:06:01 AM
2147483647 is the max value for a 32 bit signed int. This is actually a hardware limitation, capped by the 32 bit architecture.

In your case, since you are pushing gigantic numbers through the system, casting the input to an integer won't help. Instead, treat it as a string. Set the input mask to regex ((regular expression) and use the following:

/^\s*([0-9]+)\s*$/

That will emulate a number. Only digits 0-9 are accepted. Untested. And this change will leave all existing data intact.

Thank you very much, i was almost certain that some limitation was there because all searches mentioned the memory limit :S in that fel i set temporaly the no HTML, if users changed the field during this time will it keep the information even if they did not input only numbers?

thx!

Arantor

Yes, it will. Validation is only re-applied on editing the field.

mpglivecarlo

Quote from: Arantor on May 31, 2012, 07:38:50 PM
Yes, it will. Validation is only re-applied on editing the field.

THX!

Advertisement: