diff options
author | Robert Treat | 2019-06-28 03:53:19 +0000 |
---|---|---|
committer | Robert Treat | 2019-06-28 03:53:19 +0000 |
commit | 1ea83accae6229e6b63844d948ed144fe486fee0 (patch) | |
tree | a74666522a74f673a3a97634b49df663f2952562 | |
parent | 1fca558b9fd30bb7398b103419a56bf9efce2794 (diff) |
At last, the long awaited patch for php7 support.
This commit is focused strictly on the class/constructor changes. This has
primarily been tested on php 7.1 and postgres 11, with all tests passing though
there are some spurious warnings; I have fixes for them but will add them in
seperate commits.
Note that the code here is my own, but I did look at patches from
@gabrielhomsi and @w1ldzer0 for some sanity checking. Any bugs or missing
items are on me.
26 files changed, 66 insertions, 65 deletions
diff --git a/classes/ArrayRecordSet.php b/classes/ArrayRecordSet.php index b2a37547..b0612488 100644 --- a/classes/ArrayRecordSet.php +++ b/classes/ArrayRecordSet.php @@ -12,7 +12,7 @@ class ArrayRecordSet { var $EOF = false; var $fields; - function ArrayRecordSet($data) { + function __construct($data) { $this->_array = $data; $this->_count = count($this->_array); $this->fields = reset($this->_array); diff --git a/classes/Gui.php b/classes/Gui.php index 6d0fe215..f56da637 100755 --- a/classes/Gui.php +++ b/classes/Gui.php @@ -9,7 +9,7 @@ /** *Constructor */ - function GUI () {} + function __construct() {} /** * Prints a combox box diff --git a/classes/Misc.php b/classes/Misc.php index 6714bb48..281ba38b 100644 --- a/classes/Misc.php +++ b/classes/Misc.php @@ -12,7 +12,7 @@ var $form; /* Constructor */ - function Misc() { + function __construct() { } /** diff --git a/classes/class.select.php b/classes/class.select.php index 057c8d6e..73d4d252 100644 --- a/classes/class.select.php +++ b/classes/class.select.php @@ -24,7 +24,7 @@ class XHtmlSimpleElement { * derived class * */ - function XHtmlSimpleElement($element = null) { + function __construct($element = null) { $this->_element = $this->is_element(); @@ -93,8 +93,8 @@ class XHtmlElement extends XHtmlSimpleElement { var $_htmlcode = ""; var $_siblings = array(); - function XHtmlElement($text = null) { - XHtmlSimpleElement::XHtmlSimpleElement(); + function __construct($text = null) { + parent::__construct(); if ($text) $this->set_text($text); } @@ -159,8 +159,8 @@ class XHtmlElement extends XHtmlSimpleElement { } class XHTML_Button extends XHtmlElement { - function XHTML_Button ($name, $text = null) { - parent::XHtmlElement(); + function __construct($name, $text = null) { + parent::__construct(); $this->set_attribute("name", $name); @@ -170,8 +170,8 @@ class XHTML_Button extends XHtmlElement { class XHTML_Option extends XHtmlElement { - function XHTML_Option($text, $value = null) { - XHtmlElement::XHtmlElement(null); + function __construct($text, $value = null) { + parent::__construct(null); $this->set_text($text); } } @@ -180,8 +180,8 @@ class XHTML_Option extends XHtmlElement { class XHTML_Select extends XHTMLElement { var $_data; - function XHTML_Select ($name, $multiple = false, $size = null) { - XHtmlElement::XHtmlElement(); + function __construct($name, $multiple = false, $size = null) { + parent::__construct(); $this->set_attribute("name", $name); if ($multiple) $this->set_attribute("multiple","multiple"); diff --git a/classes/database/ADODB_base.php b/classes/database/ADODB_base.php index 816d6930..9e597f0f 100644 --- a/classes/database/ADODB_base.php +++ b/classes/database/ADODB_base.php @@ -20,7 +20,7 @@ class ADODB_base { * Base constructor * @param &$conn The connection object */ - function ADODB_base(&$conn) { + function __construct(&$conn) { $this->conn = $conn; } diff --git a/classes/database/Connection.php b/classes/database/Connection.php index eb22cd21..4e0695b0 100755 --- a/classes/database/Connection.php +++ b/classes/database/Connection.php @@ -19,7 +19,7 @@ class Connection { * Creates a new connection. Will actually make a database connection. * @param $fetchMode Defaults to associative. Override for different behaviour */ - function Connection($host, $port, $sslmode, $user, $password, $database, $fetchMode = ADODB_FETCH_ASSOC) { + function __construct($host, $port, $sslmode, $user, $password, $database, $fetchMode = ADODB_FETCH_ASSOC) { $this->conn = ADONewConnection('postgres7'); $this->conn->setFetchMode($fetchMode); diff --git a/classes/database/Postgres.php b/classes/database/Postgres.php index ee19990f..1eb490a0 100755 --- a/classes/database/Postgres.php +++ b/classes/database/Postgres.php @@ -169,8 +169,8 @@ class Postgres extends ADODB_base { * Constructor * @param $conn The database connection */ - function Postgres($conn) { - $this->ADODB_base($conn); + function __construct($conn) { + parent::__construct($conn); } // Formatting functions diff --git a/classes/database/Postgres10.php b/classes/database/Postgres10.php index 5f851d80..17a08124 100644 --- a/classes/database/Postgres10.php +++ b/classes/database/Postgres10.php @@ -15,8 +15,8 @@ class Postgres10 extends Postgres11 { * Constructor * @param $conn The database connection */ - function Postgres10($conn) { - $this->Postgres($conn); + function __construct($conn) { + parent::__construct($conn); } // Help functions diff --git a/classes/database/Postgres11.php b/classes/database/Postgres11.php index 2a3ae84b..38aa20fb 100644 --- a/classes/database/Postgres11.php +++ b/classes/database/Postgres11.php @@ -15,8 +15,8 @@ class Postgres11 extends Postgres { * Constructor * @param $conn The database connection */ - function Postgres11($conn) { - $this->Postgres($conn); + function __construct($conn) { + parent::__construct($conn); } // Help functions diff --git a/classes/database/Postgres74.php b/classes/database/Postgres74.php index 4310eb64..a68c4fd9 100644 --- a/classes/database/Postgres74.php +++ b/classes/database/Postgres74.php @@ -29,8 +29,8 @@ class Postgres74 extends Postgres80 { * Constructor * @param $conn The database connection */ - function Postgres74($conn) { - $this->Postgres80($conn); + function __construct($conn) { + parent::__construct($conn); } // Help functions diff --git a/classes/database/Postgres80.php b/classes/database/Postgres80.php index 1f29c1cf..db6cf098 100644 --- a/classes/database/Postgres80.php +++ b/classes/database/Postgres80.php @@ -50,8 +50,8 @@ class Postgres80 extends Postgres81 { * Constructor * @param $conn The database connection */ - function Postgres80($conn) { - $this->Postgres81($conn); + function __construct($conn) { + parent::__construct($conn); } // Help functions diff --git a/classes/database/Postgres81.php b/classes/database/Postgres81.php index 70d40b82..cfe47ee2 100644 --- a/classes/database/Postgres81.php +++ b/classes/database/Postgres81.php @@ -45,8 +45,8 @@ class Postgres81 extends Postgres82 { * Constructor * @param $conn The database connection */ - function Postgres81($conn) { - $this->Postgres82($conn); + function __construct($conn) { + parent::__construct($conn); } // Help functions diff --git a/classes/database/Postgres82.php b/classes/database/Postgres82.php index e30cd673..4b3cfd11 100644 --- a/classes/database/Postgres82.php +++ b/classes/database/Postgres82.php @@ -22,8 +22,8 @@ class Postgres82 extends Postgres83 { * Constructor * @param $conn The database connection */ - function Postgres82($conn) { - $this->Postgres($conn); + function __construct($conn) { + parent::__construct($conn); } // Help functions diff --git a/classes/database/Postgres83.php b/classes/database/Postgres83.php index ce0416b9..fc14e76e 100644 --- a/classes/database/Postgres83.php +++ b/classes/database/Postgres83.php @@ -45,8 +45,8 @@ class Postgres83 extends Postgres84 { * Constructor * @param $conn The database connection */ - function Postgres83($conn) { - $this->Postgres($conn); + function __construct($conn) { + parent::__construct($conn); } // Help functions diff --git a/classes/database/Postgres84.php b/classes/database/Postgres84.php index bc2b2b34..59d9f2f7 100755 --- a/classes/database/Postgres84.php +++ b/classes/database/Postgres84.php @@ -30,8 +30,8 @@ class Postgres84 extends Postgres90 { * Constructor * @param $conn The database connection */ - function Postgres84($conn) { - $this->Postgres($conn); + function __construct($conn) { + parent::__construct($conn); } // Help functions diff --git a/classes/database/Postgres90.php b/classes/database/Postgres90.php index 9f7b3a09..f4a9c646 100755 --- a/classes/database/Postgres90.php +++ b/classes/database/Postgres90.php @@ -16,8 +16,8 @@ class Postgres90 extends Postgres91 { * Constructor * @param $conn The database connection */ - function Postgres90($conn) { - $this->Postgres($conn); + function __construct($conn) { + parent::__construct($conn); } // Help functions diff --git a/classes/database/Postgres91.php b/classes/database/Postgres91.php index fb6d952c..91136334 100755 --- a/classes/database/Postgres91.php +++ b/classes/database/Postgres91.php @@ -16,8 +16,8 @@ class Postgres91 extends Postgres92 { * Constructor * @param $conn The database connection */ - function Postgres91($conn) { - $this->Postgres($conn); + function __construct($conn) { + parent::__construct($conn); } // Help functions diff --git a/classes/database/Postgres92.php b/classes/database/Postgres92.php index d20b188a..24621636 100644 --- a/classes/database/Postgres92.php +++ b/classes/database/Postgres92.php @@ -15,8 +15,8 @@ class Postgres92 extends Postgres93 { * Constructor * @param $conn The database connection */ - function Postgres92($conn) { - $this->Postgres($conn); + function __construct($conn) { + parent::__construct($conn); } // Help functions diff --git a/classes/database/Postgres93.php b/classes/database/Postgres93.php index 24ee22d6..308eca65 100644 --- a/classes/database/Postgres93.php +++ b/classes/database/Postgres93.php @@ -15,8 +15,8 @@ class Postgres93 extends Postgres94 { * Constructor * @param $conn The database connection */ - function Postgres93($conn) { - $this->Postgres($conn); + function __construct($conn) { + parent::__construct($conn); } // Help functions diff --git a/classes/database/Postgres94.php b/classes/database/Postgres94.php index 619b238b..908825e5 100644 --- a/classes/database/Postgres94.php +++ b/classes/database/Postgres94.php @@ -15,8 +15,8 @@ class Postgres94 extends Postgres { * Constructor * @param $conn The database connection */ - function Postgres94($conn) { - $this->Postgres($conn); + function __construct($conn) { + parent::__construct($conn); } // Help functions diff --git a/classes/database/Postgres95.php b/classes/database/Postgres95.php index 0120e550..fbe7558d 100644 --- a/classes/database/Postgres95.php +++ b/classes/database/Postgres95.php @@ -15,9 +15,9 @@ class Postgres95 extends Postgres96 { * Constructor * @param $conn The database connection */ - function Postgres95($conn) { - $this->Postgres($conn); - } + function __construct($conn) { + parent::__construct($conn); + } // Help functions diff --git a/classes/database/Postgres96.php b/classes/database/Postgres96.php index 19397e15..5375a738 100644 --- a/classes/database/Postgres96.php +++ b/classes/database/Postgres96.php @@ -15,9 +15,9 @@ class Postgres96 extends Postgres10 { * Constructor * @param $conn The database connection */ - function Postgres96($conn) { - $this->Postgres($conn); - } + function __construct($conn) { + parent::__construct($conn); + } // Help functions diff --git a/libraries/adodb/adodb.inc.php b/libraries/adodb/adodb.inc.php index 0187f55c..8cfb3887 100755 --- a/libraries/adodb/adodb.inc.php +++ b/libraries/adodb/adodb.inc.php @@ -234,7 +234,7 @@ var $createdir = true; // requires creation of temp dirs - function ADODB_Cache_File() + function __construct() { global $ADODB_INCLUDED_CSV; if (empty($ADODB_INCLUDED_CSV)) include_once(ADODB_DIR.'/adodb-csvlib.inc.php'); @@ -427,7 +427,7 @@ /** * Constructor */ - function ADOConnection() + function __construct() { die('Virtual Class -- cannot instantiate'); } @@ -2805,6 +2805,7 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 { $this->rs = $rs; } + function rewind() { $this->rs->MoveFirst(); @@ -2896,7 +2897,7 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 * @param queryID this is the queryID returned by ADOConnection->_query() * */ - function ADORecordSet($queryID) + function __construct($queryID) { $this->_queryID = $queryID; } @@ -3887,7 +3888,7 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 * Constructor * */ - function ADORecordSet_array($fakeid=1) + function __construct($fakeid=1) { global $ADODB_FETCH_MODE,$ADODB_COMPAT_FETCH; diff --git a/libraries/adodb/drivers/adodb-postgres64.inc.php b/libraries/adodb/drivers/adodb-postgres64.inc.php index 6846303a..7b838a88 100644 --- a/libraries/adodb/drivers/adodb-postgres64.inc.php +++ b/libraries/adodb/drivers/adodb-postgres64.inc.php @@ -873,7 +873,7 @@ class ADORecordSet_postgres64 extends ADORecordSet{ var $_blobArr; var $databaseType = "postgres64"; var $canSeek = true; - function ADORecordSet_postgres64($queryID,$mode=false) + function __construct($queryID,$mode=false) { if ($mode === false) { global $ADODB_FETCH_MODE; @@ -889,7 +889,7 @@ class ADORecordSet_postgres64 extends ADORecordSet{ default: $this->fetchMode = PGSQL_BOTH; break; } $this->adodbFetchMode = $mode; - $this->ADORecordSet($queryID); + parent::__construct($queryID); } function GetRowAssoc($upper=true) diff --git a/libraries/adodb/drivers/adodb-postgres7.inc.php b/libraries/adodb/drivers/adodb-postgres7.inc.php index eecfdc37..1ce0350e 100644 --- a/libraries/adodb/drivers/adodb-postgres7.inc.php +++ b/libraries/adodb/drivers/adodb-postgres7.inc.php @@ -215,9 +215,9 @@ class ADORecordSet_postgres7 extends ADORecordSet_postgres64{ var $databaseType = "postgres7"; - function ADORecordSet_postgres7($queryID,$mode=false) + function __construct($queryID,$mode=false) { - $this->ADORecordSet_postgres64($queryID,$mode); + parent::__construct($queryID,$mode); } // 10% speedup to move MoveNext to child class @@ -310,4 +310,4 @@ class ADORecordSet_assoc_postgres7 extends ADORecordSet_postgres64{ return false; } } -?>
\ No newline at end of file +?> diff --git a/libraries/decorator.inc.php b/libraries/decorator.inc.php index c31e6181..617e9206 100644 --- a/libraries/decorator.inc.php +++ b/libraries/decorator.inc.php @@ -91,7 +91,7 @@ function value_url(&$var, &$fields) { class Decorator { - function Decorator($value) { + function __construct($value) { $this->v = $value; } @@ -102,7 +102,7 @@ class Decorator class FieldDecorator extends Decorator { - function FieldDecorator($fieldName, $default = null) { + function __construct($fieldName, $default = null) { $this->f = $fieldName; if ($default !== null) $this->d = $default; } @@ -114,7 +114,7 @@ class FieldDecorator extends Decorator class ArrayMergeDecorator extends Decorator { - function ArrayMergeDecorator($arrays) { + function __construct($arrays) { $this->m = $arrays; } @@ -129,7 +129,7 @@ class ArrayMergeDecorator extends Decorator class ConcatDecorator extends Decorator { - function ConcatDecorator($values) { + function __construct($values) { $this->c = $values; } @@ -144,7 +144,7 @@ class ConcatDecorator extends Decorator class CallbackDecorator extends Decorator { - function CallbackDecorator($callback, $param = null) { + function __construct($callback, $param = null) { $this->fn = $callback; $this->p = $param; } @@ -156,7 +156,7 @@ class CallbackDecorator extends Decorator class IfEmptyDecorator extends Decorator { - function IfEmptyDecorator($value, $empty, $full = null) { + function __construct($value, $empty, $full = null) { $this->v = $value; $this->e = $empty; if ($full !== null) $this->f = $full; @@ -173,7 +173,7 @@ class IfEmptyDecorator extends Decorator class UrlDecorator extends Decorator { - function UrlDecorator($base, $queryVars = null) { + function __construct($base, $queryVars = null) { $this->b = $base; if ($queryVars !== null) $this->q = $queryVars; @@ -199,7 +199,7 @@ class UrlDecorator extends Decorator class replaceDecorator extends Decorator { - function replaceDecorator($str, $params) { + function __construct($str, $params) { $this->s = $str; $this->p = $params; } |