In-Portal Issue Tracker - In-Portal CMS
Viewing Issue Advanced Details
1226 [In-Portal CMS] Database bug report always 2012-03-14 12:31 2012-07-25 05:31
alex  
alex  
normal  
closed 5.2.0-B2  
fixed  
 
none 5.2.0-B3  
https://groups.google.com/d/topic/in-portal-bugs/stMGddx3KJk/discussion
Fixes problems with crc32 function usage on 64bit web servers
1
0001226: Storing function "crc32" results in database problem
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.
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;
parent of 0001223closed  (5.2.0)!COMMUNITY Fatal on viewing page in Browse Mode via Catalog with MySQL in Strict mode 
patch crc32_signed_problem_core.patch (8,730) 2012-03-27 06:45
http://tracker.in-portal.org/file_download.php?file_id=1576&type=bug
patch crc32_signed_problem_modules.patch (7,639) 2012-03-27 06:46
http://tracker.in-portal.org/file_download.php?file_id=1577&type=bug
Issue History
2012-07-25 05:31 alex Note Added: 0004947
2012-07-25 05:31 alex Status resolved => closed
2012-03-27 06:52 alex Relationship added parent of 0001223
2012-03-27 06:51 alex Note Added: 0004529
2012-03-27 06:51 alex Status reviewed and tested => resolved
2012-03-27 06:51 alex Fixed in Version => 5.2.0-B3
2012-03-27 06:51 alex Resolution open => fixed
2012-03-27 06:51 alex Assigned To !COMMUNITY => alex
2012-03-27 06:51 alex Changeset attached 5.2.x r15246
2012-03-27 06:50 alex Changeset attached 5.2.x r15245
2012-03-27 06:48 alex Changeset attached 5.2.x r15244
2012-03-27 06:47 alex Changeset attached 5.2.x r15243
2012-03-27 06:46 alex Note Added: 0004528
2012-03-27 06:46 alex Status needs testing => reviewed and tested
2012-03-27 06:46 alex Assigned To => !COMMUNITY
2012-03-27 06:46 alex Developer => alex
2012-03-27 06:46 alex Status active => needs testing
2012-03-27 06:46 alex File Added: crc32_signed_problem_modules.patch
2012-03-27 06:45 alex File Added: crc32_signed_problem_core.patch
2012-03-27 06:45 alex Additional Information Updated bug_revision_view_page.php?rev_id=990#r990
2012-03-14 12:31 alex New Issue
2012-03-14 12:31 alex Reference => https://groups.google.com/d/topic/in-portal-bugs/stMGddx3KJk/discussion
2012-03-14 12:31 alex Change Log Message => Fixes problems with crc32 function usage on 64bit web servers
2012-03-14 12:31 alex Estimate Points => 1

Notes
(0004528)
alex   
2012-03-27 06:46   
Will test all together later.
(0004529)
alex   
2012-03-27 06:51   
Fix committed to 5.2.x branch. Commit Message:

Fixes 0001226: Storing function "crc32" results in database problem
(0004947)
alex   
2012-07-25 05:31   
Since 5.2.0 version was released.