mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-18 14:31:19 +02:00
[ticket/15849] Stop using php4 constructors
PHPBB3-15849
This commit is contained in:
@@ -126,7 +126,7 @@ define ( "SPH_GROUPBY_ATTRPAIR", 5 );
|
||||
function sphPackI64 ( $v )
|
||||
{
|
||||
assert ( is_numeric($v) );
|
||||
|
||||
|
||||
// x64
|
||||
if ( PHP_INT_SIZE>=8 )
|
||||
{
|
||||
@@ -138,7 +138,7 @@ function sphPackI64 ( $v )
|
||||
if ( is_int($v) )
|
||||
return pack ( "NN", $v < 0 ? -1 : 0, $v );
|
||||
|
||||
// x32, bcmath
|
||||
// x32, bcmath
|
||||
if ( function_exists("bcmul") )
|
||||
{
|
||||
if ( bccomp ( $v, 0 ) == -1 )
|
||||
@@ -175,16 +175,16 @@ function sphPackI64 ( $v )
|
||||
function sphPackU64 ( $v )
|
||||
{
|
||||
assert ( is_numeric($v) );
|
||||
|
||||
|
||||
// x64
|
||||
if ( PHP_INT_SIZE>=8 )
|
||||
{
|
||||
assert ( $v>=0 );
|
||||
|
||||
|
||||
// x64, int
|
||||
if ( is_int($v) )
|
||||
return pack ( "NN", $v>>32, $v&0xFFFFFFFF );
|
||||
|
||||
|
||||
// x64, bcmath
|
||||
if ( function_exists("bcmul") )
|
||||
{
|
||||
@@ -192,12 +192,12 @@ function sphPackU64 ( $v )
|
||||
$l = bcmod ( $v, 4294967296 );
|
||||
return pack ( "NN", $h, $l );
|
||||
}
|
||||
|
||||
|
||||
// x64, no-bcmath
|
||||
$p = max ( 0, strlen($v) - 13 );
|
||||
$lo = (int)substr ( $v, $p );
|
||||
$hi = (int)substr ( $v, 0, $p );
|
||||
|
||||
|
||||
$m = $lo + $hi*1316134912;
|
||||
$l = $m % 4294967296;
|
||||
$h = $hi*2328 + (int)($m/4294967296);
|
||||
@@ -208,7 +208,7 @@ function sphPackU64 ( $v )
|
||||
// x32, int
|
||||
if ( is_int($v) )
|
||||
return pack ( "NN", 0, $v );
|
||||
|
||||
|
||||
// x32, bcmath
|
||||
if ( function_exists("bcmul") )
|
||||
{
|
||||
@@ -221,7 +221,7 @@ function sphPackU64 ( $v )
|
||||
$p = max(0, strlen($v) - 13);
|
||||
$lo = (float)substr($v, $p);
|
||||
$hi = (float)substr($v, 0, $p);
|
||||
|
||||
|
||||
$m = $lo + $hi*1316134912.0;
|
||||
$q = floor($m / 4294967296.0);
|
||||
$l = $m - ($q * 4294967296.0);
|
||||
@@ -277,11 +277,11 @@ function sphUnpackU64 ( $v )
|
||||
// x32, bcmath
|
||||
if ( function_exists("bcmul") )
|
||||
return bcadd ( $lo, bcmul ( $hi, "4294967296" ) );
|
||||
|
||||
|
||||
// x32, no-bcmath
|
||||
$hi = (float)$hi;
|
||||
$lo = (float)$lo;
|
||||
|
||||
|
||||
$q = floor($hi/10000000.0);
|
||||
$r = $hi - $q*10000000.0;
|
||||
$m = $lo + $r*4967296.0;
|
||||
@@ -324,7 +324,7 @@ function sphUnpackI64 ( $v )
|
||||
return $lo;
|
||||
return sprintf ( "%.0f", $lo - 4294967296.0 );
|
||||
}
|
||||
|
||||
|
||||
$neg = "";
|
||||
$c = 0;
|
||||
if ( $hi<0 )
|
||||
@@ -333,7 +333,7 @@ function sphUnpackI64 ( $v )
|
||||
$lo = ~$lo;
|
||||
$c = 1;
|
||||
$neg = "-";
|
||||
}
|
||||
}
|
||||
|
||||
$hi = sprintf ( "%u", $hi );
|
||||
$lo = sprintf ( "%u", $lo );
|
||||
@@ -345,7 +345,7 @@ function sphUnpackI64 ( $v )
|
||||
// x32, no-bcmath
|
||||
$hi = (float)$hi;
|
||||
$lo = (float)$lo;
|
||||
|
||||
|
||||
$q = floor($hi/10000000.0);
|
||||
$r = $hi - $q*10000000.0;
|
||||
$m = $lo + $r*4967296.0;
|
||||
@@ -427,7 +427,7 @@ class SphinxClient
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// create a new client object and fill defaults
|
||||
function SphinxClient ()
|
||||
function __construct ()
|
||||
{
|
||||
// per-client-object settings
|
||||
$this->_host = "localhost";
|
||||
@@ -510,7 +510,7 @@ class SphinxClient
|
||||
$this->_path = $host;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
assert ( is_int($port) );
|
||||
$this->_host = $host;
|
||||
$this->_port = $port;
|
||||
@@ -590,14 +590,14 @@ class SphinxClient
|
||||
$fp = @fsockopen ( $host, $port, $errno, $errstr );
|
||||
else
|
||||
$fp = @fsockopen ( $host, $port, $errno, $errstr, $this->_timeout );
|
||||
|
||||
|
||||
if ( !$fp )
|
||||
{
|
||||
if ( $this->_path )
|
||||
$location = $this->_path;
|
||||
else
|
||||
$location = "{$this->_host}:{$this->_port}";
|
||||
|
||||
|
||||
$errstr = trim ( $errstr );
|
||||
$this->_error = "connection to $location failed (errno=$errno, msg=$errstr)";
|
||||
$this->_connerror = true;
|
||||
@@ -1236,7 +1236,7 @@ class SphinxClient
|
||||
if ( $type==SPH_ATTR_FLOAT )
|
||||
{
|
||||
list(,$uval) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4;
|
||||
list(,$fval) = unpack ( "f*", pack ( "L", $uval ) );
|
||||
list(,$fval) = unpack ( "f*", pack ( "L", $uval ) );
|
||||
$attrvals[$attr] = $fval;
|
||||
continue;
|
||||
}
|
||||
@@ -1264,7 +1264,7 @@ class SphinxClient
|
||||
} else if ( $type==SPH_ATTR_STRING )
|
||||
{
|
||||
$attrvals[$attr] = substr ( $response, $p, $val );
|
||||
$p += $val;
|
||||
$p += $val;
|
||||
} else
|
||||
{
|
||||
$attrvals[$attr] = sphFixUint($val);
|
||||
@@ -1345,7 +1345,7 @@ class SphinxClient
|
||||
if ( !isset($opts["passage_boundary"]) ) $opts["passage_boundary"] = "none";
|
||||
if ( !isset($opts["emit_zones"]) ) $opts["emit_zones"] = false;
|
||||
if ( !isset($opts["load_files_scattered"]) ) $opts["load_files_scattered"] = false;
|
||||
|
||||
|
||||
|
||||
/////////////////
|
||||
// build request
|
||||
@@ -1634,7 +1634,7 @@ class SphinxClient
|
||||
|
||||
fclose ( $this->_socket );
|
||||
$this->_socket = false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user