The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
fetch_foruminfo converts string to float
Hi,
I've added a custom field 'ivw_code' to the 'forum' table. It is of type VARCHAR(25). If I call 'fetch_foruminfo' for a forum which has set this field to '12E03611', the returned array will contain the field as float(INF) instead of a string. This does not happen if I tell fetch_foruminfo to not use the cache, but read from the database. So VB somewhere tries to be smart and converts the string to a float because of the 'E' in it. How can I avoid this? Regards TiKu |
#2
|
|||
|
|||
The code that builds the forumcache contains this (as part of a loop through the columns):
Code:
/* values which begin with 0 and are greater than 1 character are strings, since 01 would be an octal number in PHP */ if (is_numeric($val) AND !(substr($val, 0, 1) == '0' AND strlen($val) > 1) AND !in_array($key, array('title', 'title_clean', 'description', 'description_clean'))) { $newforum["$key"] += 0; } which (for some reason) forces a numeric type on fields that represent numbers. So I guess you would either need to store something that's not a number (like add a prefix to your code values), or if that doesn't work for you you could change that code (like adding 'ivw_code' to the array of column names in the code shown above). |
#3
|
||||
|
||||
I don't want to edit VB files as this makes updates a pain. So now I'm prepending a character. It's an ugly hack, but it works. Thank you.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|