Using base_convert() with Numbers Larger than PHP_INT_MAX
PHP applications call base_convert() to convert large numeric strings between bases (hexadecimal to decimal, base64 to decimal) without considering PHP's integer precision limits. The base_convert() function internally uses floating-point arithmetic for calculations when numbers exceed PHP_INT_MAX (typically 2^63-1 on 64-bit systems or 2^31-1 on 32-bit systems). When converting values like base_convert('FFFFFFFFFFFFFFFF', 16, 10) (16 F's representing a 64-bit value), PHP promotes the calculation to floating-point (double precision) which has only 53 bits of mantissa precision per IEEE 754 standard. This causes the least significant bits to be rounded or lost, producing incorrect results. A typical vulnerable pattern converts cryptographic hash outputs to decimal: $hashValue = base_convert(hash('sha256', $data), 16, 10), where SHA-256's 256-bit output far exceeds floating-point precision, resulting in a value that appears numeric but has lost significant precision, creating security issues in comparisons, authentication tokens, or unique identifiers where collisions become possible due to multiple different inputs producing identical truncated output.