[ticket/15849] Stop using php4 constructors

PHPBB3-15849
This commit is contained in:
Ruben Calvo 2018-10-21 05:56:29 +00:00
parent ae6c3b0d34
commit b148bb5d70
25 changed files with 64 additions and 64 deletions

View file

@ -33,7 +33,7 @@ class build_package
var $status_begun = false; var $status_begun = false;
var $num_dots = 0; var $num_dots = 0;
function build_package($versions, $verbose = false) function __construct($versions, $verbose = false)
{ {
$this->versions = $versions; $this->versions = $versions;
$this->verbose = $verbose; $this->verbose = $verbose;

View file

@ -24,7 +24,7 @@ class acp_inactive
var $u_action; var $u_action;
var $p_master; var $p_master;
function acp_inactive(&$p_master) function __construct(&$p_master)
{ {
$this->p_master = &$p_master; $this->p_master = &$p_master;
} }

View file

@ -24,7 +24,7 @@ class acp_users
var $u_action; var $u_action;
var $p_master; var $p_master;
function acp_users(&$p_master) function __construct(&$p_master)
{ {
$this->p_master = &$p_master; $this->p_master = &$p_master;
} }

View file

@ -27,7 +27,7 @@ class auth_admin extends \phpbb\auth\auth
/** /**
* Init auth settings * Init auth settings
*/ */
function auth_admin() function __construct()
{ {
global $db, $cache; global $db, $cache;
@ -819,7 +819,7 @@ class auth_admin extends \phpbb\auth\auth
// Because we just changed the options and also purged the options cache, we instantly update/regenerate it for later calls to succeed. // Because we just changed the options and also purged the options cache, we instantly update/regenerate it for later calls to succeed.
$this->acl_options = array(); $this->acl_options = array();
$this->auth_admin(); $this->__construct();
return true; return true;
} }

View file

@ -37,7 +37,7 @@ class bbcode
* Constructor * Constructor
* Init bbcode cache entries if bitfield is specified * Init bbcode cache entries if bitfield is specified
*/ */
function bbcode($bitfield = '') function __construct($bitfield = '')
{ {
if ($bitfield) if ($bitfield)
{ {

View file

@ -50,7 +50,7 @@ class diff
* @param array &$to_content An array of strings. * @param array &$to_content An array of strings.
* @param bool $preserve_cr If true, \r is replaced by a new line in the diff output * @param bool $preserve_cr If true, \r is replaced by a new line in the diff output
*/ */
function diff(&$from_content, &$to_content, $preserve_cr = true) function __construct(&$from_content, &$to_content, $preserve_cr = true)
{ {
$diff_engine = new diff_engine(); $diff_engine = new diff_engine();
$this->_edits = $diff_engine->diff($from_content, $to_content, $preserve_cr); $this->_edits = $diff_engine->diff($from_content, $to_content, $preserve_cr);
@ -330,14 +330,14 @@ class mapped_diff extends diff
* compared when computing the diff. * compared when computing the diff.
* @param array $mapped_to_lines This array should have the same number of elements as $to_lines. * @param array $mapped_to_lines This array should have the same number of elements as $to_lines.
*/ */
function mapped_diff(&$from_lines, &$to_lines, &$mapped_from_lines, &$mapped_to_lines) function __construct(&$from_lines, &$to_lines, &$mapped_from_lines, &$mapped_to_lines)
{ {
if (count($from_lines) != count($mapped_from_lines) || count($to_lines) != count($mapped_to_lines)) if (count($from_lines) != count($mapped_from_lines) || count($to_lines) != count($mapped_to_lines))
{ {
return false; return false;
} }
parent::diff($mapped_from_lines, $mapped_to_lines); parent::__construct($mapped_from_lines, $mapped_to_lines);
$xi = $yi = 0; $xi = $yi = 0;
for ($i = 0; $i < count($this->_edits); $i++) for ($i = 0; $i < count($this->_edits); $i++)
@ -394,7 +394,7 @@ class diff_op
*/ */
class diff_op_copy extends diff_op class diff_op_copy extends diff_op
{ {
function diff_op_copy($orig, $final = false) function __construct($orig, $final = false)
{ {
if (!is_array($final)) if (!is_array($final))
{ {
@ -419,7 +419,7 @@ class diff_op_copy extends diff_op
*/ */
class diff_op_delete extends diff_op class diff_op_delete extends diff_op
{ {
function diff_op_delete($lines) function __construct($lines)
{ {
$this->orig = $lines; $this->orig = $lines;
$this->final = false; $this->final = false;
@ -440,7 +440,7 @@ class diff_op_delete extends diff_op
*/ */
class diff_op_add extends diff_op class diff_op_add extends diff_op
{ {
function diff_op_add($lines) function __construct($lines)
{ {
$this->final = $lines; $this->final = $lines;
$this->orig = false; $this->orig = false;
@ -461,7 +461,7 @@ class diff_op_add extends diff_op
*/ */
class diff_op_change extends diff_op class diff_op_change extends diff_op
{ {
function diff_op_change($orig, $final) function __construct($orig, $final)
{ {
$this->orig = $orig; $this->orig = $orig;
$this->final = $final; $this->final = $final;
@ -498,7 +498,7 @@ class diff3 extends diff
* @param bool $preserve_cr If true, \r\n and bare \r are replaced by a new line * @param bool $preserve_cr If true, \r\n and bare \r are replaced by a new line
* in the diff output * in the diff output
*/ */
function diff3(&$orig, &$final1, &$final2, $preserve_cr = true) function __construct(&$orig, &$final1, &$final2, $preserve_cr = true)
{ {
$diff_engine = new diff_engine(); $diff_engine = new diff_engine();
@ -754,7 +754,7 @@ class diff3 extends diff
*/ */
class diff3_op class diff3_op
{ {
function diff3_op($orig = false, $final1 = false, $final2 = false) function __construct($orig = false, $final1 = false, $final2 = false)
{ {
$this->orig = $orig ? $orig : array(); $this->orig = $orig ? $orig : array();
$this->final1 = $final1 ? $final1 : array(); $this->final1 = $final1 ? $final1 : array();
@ -1066,7 +1066,7 @@ class diff3_op
*/ */
class diff3_op_copy extends diff3_op class diff3_op_copy extends diff3_op
{ {
function diff3_op_copy($lines = false) function __construct($lines = false)
{ {
$this->orig = $lines ? $lines : array(); $this->orig = $lines ? $lines : array();
$this->final1 = &$this->orig; $this->final1 = &$this->orig;
@ -1092,7 +1092,7 @@ class diff3_op_copy extends diff3_op
*/ */
class diff3_block_builder class diff3_block_builder
{ {
function diff3_block_builder() function __construct()
{ {
$this->_init(); $this->_init();
} }

View file

@ -56,7 +56,7 @@ class diff_renderer
/** /**
* Constructor. * Constructor.
*/ */
function diff_renderer($params = array()) function __construct($params = array())
{ {
foreach ($params as $param => $value) foreach ($params as $param => $value)
{ {

View file

@ -210,7 +210,7 @@ class compress_zip extends compress
/** /**
* Constructor * Constructor
*/ */
function compress_zip($mode, $file) function __construct($mode, $file)
{ {
global $phpbb_filesystem; global $phpbb_filesystem;
@ -569,7 +569,7 @@ class compress_tar extends compress
/** /**
* Constructor * Constructor
*/ */
function compress_tar($mode, $file, $type = '') function __construct($mode, $file, $type = '')
{ {
global $phpbb_filesystem; global $phpbb_filesystem;

View file

@ -1672,7 +1672,7 @@ class bitfield
{ {
var $data; var $data;
function bitfield($bitfield = '') function __construct($bitfield = '')
{ {
$this->data = base64_decode($bitfield); $this->data = base64_decode($bitfield);
} }

View file

@ -37,7 +37,7 @@ class messenger
/** /**
* Constructor * Constructor
*/ */
function messenger($use_queue = true) function __construct($use_queue = true)
{ {
global $config; global $config;
@ -781,7 +781,7 @@ class queue
/** /**
* constructor * constructor
*/ */
function queue() function __construct()
{ {
global $phpEx, $phpbb_root_path, $phpbb_filesystem, $phpbb_container; global $phpEx, $phpbb_root_path, $phpbb_filesystem, $phpbb_container;
@ -1317,7 +1317,7 @@ class smtp_class
var $backtrace = false; var $backtrace = false;
var $backtrace_log = array(); var $backtrace_log = array();
function smtp_class() function __construct()
{ {
// Always create a backtrace for admins to identify SMTP problems // Always create a backtrace for admins to identify SMTP problems
$this->backtrace = true; $this->backtrace = true;

View file

@ -40,7 +40,7 @@ class p_master
* Constuctor * Constuctor
* Set module include path * Set module include path
*/ */
function p_master($include_path = false) function __construct($include_path = false)
{ {
global $phpbb_root_path; global $phpbb_root_path;

View file

@ -38,7 +38,7 @@ class transfer
/** /**
* Constructor - init some basic values * Constructor - init some basic values
*/ */
function transfer() function __construct()
{ {
global $phpbb_root_path; global $phpbb_root_path;
@ -264,7 +264,7 @@ class ftp extends transfer
/** /**
* Standard parameters for FTP session * Standard parameters for FTP session
*/ */
function ftp($host, $username, $password, $root_path, $port = 21, $timeout = 10) function __construct($host, $username, $password, $root_path, $port = 21, $timeout = 10)
{ {
$this->host = $host; $this->host = $host;
$this->port = $port; $this->port = $port;
@ -512,7 +512,7 @@ class ftp_fsock extends transfer
/** /**
* Standard parameters for FTP session * Standard parameters for FTP session
*/ */
function ftp_fsock($host, $username, $password, $root_path, $port = 21, $timeout = 10) function __construct($host, $username, $password, $root_path, $port = 21, $timeout = 10)
{ {
$this->host = $host; $this->host = $host;
$this->port = $port; $this->port = $port;
@ -529,7 +529,7 @@ class ftp_fsock extends transfer
} }
// Init some needed values // Init some needed values
$this->transfer(); parent::__construct();
return; return;
} }

View file

@ -44,7 +44,7 @@ class phpbb_hook
* *
* @param array $valid_hooks array containing the hookable functions/methods * @param array $valid_hooks array containing the hookable functions/methods
*/ */
function phpbb_hook($valid_hooks) function __construct($valid_hooks)
{ {
foreach ($valid_hooks as $_null => $method) foreach ($valid_hooks as $_null => $method)
{ {

View file

@ -28,7 +28,7 @@ class mcp_logs
var $u_action; var $u_action;
var $p_master; var $p_master;
function mcp_logs(&$p_master) function __construct(&$p_master)
{ {
$this->p_master = &$p_master; $this->p_master = &$p_master;
} }

View file

@ -28,7 +28,7 @@ class mcp_main
var $p_master; var $p_master;
var $u_action; var $u_action;
function mcp_main(&$p_master) function __construct(&$p_master)
{ {
$this->p_master = &$p_master; $this->p_master = &$p_master;
} }

View file

@ -28,7 +28,7 @@ class mcp_notes
var $p_master; var $p_master;
var $u_action; var $u_action;
function mcp_notes(&$p_master) function __construct(&$p_master)
{ {
$this->p_master = &$p_master; $this->p_master = &$p_master;
} }

View file

@ -28,7 +28,7 @@ class mcp_pm_reports
var $p_master; var $p_master;
var $u_action; var $u_action;
function mcp_pm_reports(&$p_master) function __construct(&$p_master)
{ {
$this->p_master = &$p_master; $this->p_master = &$p_master;
} }

View file

@ -28,7 +28,7 @@ class mcp_queue
var $p_master; var $p_master;
var $u_action; var $u_action;
public function mcp_queue(&$p_master) public function __construct(&$p_master)
{ {
$this->p_master = &$p_master; $this->p_master = &$p_master;
} }

View file

@ -28,7 +28,7 @@ class mcp_reports
var $p_master; var $p_master;
var $u_action; var $u_action;
function mcp_reports(&$p_master) function __construct(&$p_master)
{ {
$this->p_master = &$p_master; $this->p_master = &$p_master;
} }

View file

@ -28,7 +28,7 @@ class mcp_warn
var $p_master; var $p_master;
var $u_action; var $u_action;
function mcp_warn(&$p_master) function __construct(&$p_master)
{ {
$this->p_master = &$p_master; $this->p_master = &$p_master;
} }

View file

@ -1139,7 +1139,7 @@ class parse_message extends bbcode_firstpass
/** /**
* Init - give message here or manually * Init - give message here or manually
*/ */
function parse_message($message = '') function __construct($message = '')
{ {
// Init BBCode UID // Init BBCode UID
$this->bbcode_uid = substr(base_convert(unique_id(), 16, 36), 0, BBCODE_UID_LEN); $this->bbcode_uid = substr(base_convert(unique_id(), 16, 36), 0, BBCODE_UID_LEN);

View file

@ -40,7 +40,7 @@ class phpbb_questionnaire_data_collector
* *
* @param string * @param string
*/ */
function phpbb_questionnaire_data_collector($install_id) function __construct($install_id)
{ {
$this->install_id = $install_id; $this->install_id = $install_id;
$this->providers = array(); $this->providers = array();
@ -223,7 +223,7 @@ class phpbb_questionnaire_phpbb_data_provider
* *
* @param array $config * @param array $config
*/ */
function phpbb_questionnaire_phpbb_data_provider($config) function __construct($config)
{ {
// generate a unique id if necessary // generate a unique id if necessary
if (empty($config['questionnaire_unique_id'])) if (empty($config['questionnaire_unique_id']))

View file

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

View file

@ -28,7 +28,7 @@ class ucp_main
var $p_master; var $p_master;
var $u_action; var $u_action;
function ucp_main(&$p_master) function __construct(&$p_master)
{ {
$this->p_master = &$p_master; $this->p_master = &$p_master;
} }

View file

@ -18,7 +18,7 @@ class phpbb_cache_memory extends \phpbb\cache\driver\memory
/** /**
* Set cache path * Set cache path
*/ */
function phpbb_cache_memory() function __construct()
{ {
} }