In-Portal Issue Tracker

Welcome to the In-Portal Open Source CMS Issue Tracker! This is a central management / tracking tool for all types of tasks / issues / bugs for the In-Portal Project. Before reporting any issues, please make sure to read the Guide into Issue Tracker and How to Properly Test and Report Bugs!

Relationship Graph View Issue ] Dependency Graph ]
related to child of duplicate of

Viewing Issue Simple Details
ID Category Type Reproducibility Date Submitted Last Update
0001226 [In-Portal CMS] Database bug report always 2012-03-14 12:31 2012-07-25 05:31
Reporter alex View Status public  
Assigned To alex
Priority normal Resolution fixed  
Status closed      
Summary 0001226: Storing function "crc32" results in database problem
Description When web server OS is 32bit, then results of crc32 functions are positive and negative numbers in range, that fits nicely in "signed int" column in MySQL database.

However, when web server OS is 64bit, then same crc32 function produces only positive numbers (internally converts negative results to positive, not by removing sign from them) producing number is no longer fits into "signed it" range and will fit only in:
* unsigned int
* signed/unsigned bigint

Since we can't guess what architecture of web server, that will run In-Portal, would be then we need to:
convert all negative results of crc32 function to positive using $positive_crc = printf('%u', $crc) code
make all db columns, that can store such numbers either "int unsigned" or "bigint"

In 5.2.0-B2 this was noticed after tag <inp2:st_ContentBlock name="logos"/> was executed and produced content block number was stored incorrectly resulting inability to save content block changes.
Additional Information We have 54 places, where crc32 function is used (across all modules) and each place needs to be inspected.

How to perform conversion in MySQL:
-----------------------------------

ALTER TABLE TableName CHANGE FieldName FieldName BIGINT(11) NOT NULL DEFAULT '0';

UPDATE TableName
SET FieldName = CAST((FieldName & 0xFFFFFFFF) AS UNSIGNED INTEGER)
WHERE FieldName < 0;



Web Development by Intechnic
In-Portal Open Source CMS
In-Portal Open Source CMS
Copyright © 2000 - 2009 MantisBT Group

Powered by Mantis Bugtracker