Differences

This shows you the differences between two versions of the page.

Link to this comparison view

userid_handling [2013/09/12 22:49] (current)
Line 1: Line 1:
 +In previous series of BeBot UserID'​s have been treated as integer values. This has been due to the fact that unlike most other operations in PHP, unpack() does NOT automatically convert numeric values greater than a 32bit integer can handle to a float. As such BeBot allowed the integer to overflow to become a negative signed integer.
  
 +As of BeBot 0.7.0 this is no longer true. We now handle high UserID'​s as floats, and as such this means special care have to be taken whenever comparing UserID'​s.
 +
 +Do NOT compare UserID'​s the way you would a normal integer, ie 
 +<code php>
 +if ($userid == $userid2)
 +</​code>​
 +Instead use the bc_cmp function, ie 
 +<code php>
 +if (bccomp($userid,​ $userid2) == 0)
 +</​code>​
 +
 +bccomp return values are
 +<​code>​
 +Returns 0 if the two operands are equal, 1 if the left_operand ​ is larger than the right_operand , -1 otherwise. ​
 +</​code>​
 
userid_handling.txt ยท Last modified: 2013/09/12 22:49 (external edit)
[unknown button type]
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
WikiForumIRCBugs
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki