userid_handling

Differences

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

Link to this comparison view

userid_handling [2013/09/12 22:49]
userid_handling [2020/09/12 01:30] (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: 2020/09/12 01:30
  • (external edit)