Project

General

Profile

« Previous | Next » 

Revision ac655e1b

Added by Ermal LUÇI about 14 years ago

Use the availble constant on php for this and also the right value that comes with it since PHP never supported u_int. There is a bug open still on PHP about bcmod but some more info is needed.

View differences:

usr/local/captiveportal/radius_accounting.inc
294 294
     */
295 295

  
296 296
    // We use BCMath functions since normal integers don't work with so large numbers
297
    $gigawords = bcdiv( bcsub( $bytes, remainder($bytes) ) , 4294967295) ;
297
    $gigawords = bcdiv( bcsub( $bytes, remainder($bytes) ) , PHP_INT_MAX) ;
298 298

  
299 299
    // We need to manually set this to a zero instead of NULL for put_int() safety
300 300
    if (is_null($gigawords)) {
......
308 308
function remainder($bytes) {
309 309

  
310 310
    // Calculate the bytes we are going to send to the radius
311
    $bytes = bcmod($bytes, 4294967295);
311
    $bytes = bcmod($bytes, PHP_INT_MAX);
312 312

  
313 313
    if (is_null($bytes)) {
314 314
        $bytes = 0;

Also available in: Unified diff