At last, the long awaited patch for php7 support.
authorRobert Treat <rob@xzilla.net>
Fri, 28 Jun 2019 03:53:19 +0000 (23:53 -0400)
committerRobert Treat <rob@xzilla.net>
Fri, 28 Jun 2019 03:53:19 +0000 (23:53 -0400)
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:
classes/ArrayRecordSet.php
classes/Gui.php
classes/Misc.php
classes/class.select.php
classes/database/ADODB_base.php
classes/database/Connection.php
classes/database/Postgres.php
classes/database/Postgres10.php
classes/database/Postgres11.php
classes/database/Postgres74.php
classes/database/Postgres80.php
classes/database/Postgres81.php
classes/database/Postgres82.php
classes/database/Postgres83.php
classes/database/Postgres84.php
classes/database/Postgres90.php
classes/database/Postgres91.php
classes/database/Postgres92.php
classes/database/Postgres93.php
classes/database/Postgres94.php
classes/database/Postgres95.php
classes/database/Postgres96.php
libraries/adodb/adodb.inc.php
libraries/adodb/drivers/adodb-postgres64.inc.php
libraries/adodb/drivers/adodb-postgres7.inc.php
libraries/decorator.inc.php

index b2a375476be4bb85898fde32cfae967d28d15903..b0612488c028b59d8bb6835a29ec6968de7cf496 100644 (file)
@@ -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);
index 6d0fe2156a1e8cc717ca8027bfb1f4b427aa53d9..f56da637b4ba7c12f5b0287c8e16670a0543456c 100755 (executable)
@@ -9,7 +9,7 @@
                /**
                 *Constructor
                 */
-               function GUI () {}
+               function __construct() {}
                 
                /**
                 * Prints a combox box
index 6714bb48f2b20aa26e18b4f3366d5d5395a71968..281ba38b99ff60eeb9e71332c99b5a1c50a936e9 100644 (file)
@@ -12,7 +12,7 @@
                var $form;
 
                /* Constructor */
-               function Misc() {
+               function __construct() { 
                }
 
                /**
index 057c8d6eaa27da4f6a6308f8e4daab2759ea498e..73d4d2527971a11d526ade91de50d9b52e393511 100644 (file)
@@ -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");
index 816d6930219e7e06358f80f31ac43a3105b3439a..9e597f0fb615a8d595be336ac51eaa89d76fd726 100644 (file)
@@ -20,7 +20,7 @@ class ADODB_base {
         * Base constructor
         * @param &$conn The connection object
         */
-       function ADODB_base(&$conn) {
+       function __construct(&$conn) {
                $this->conn = $conn;
        }
 
index eb22cd2152c98d1e0eb3d01fdb41d91da1ee8fc7..4e0695b0653ac214a9d9e4cf17664a9472bec34b 100755 (executable)
@@ -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);
 
index ee19990f29ff8477d1b15d40c92d180acaa2d3f8..1eb490a0f7f3741aea7bcf7ba9f895b51e5f85b1 100755 (executable)
@@ -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
index 5f851d80453bb9e7cf375bb085fdc452ee5e1eda..17a0812457724b7b263f2f94193f9f4620b290d6 100644 (file)
@@ -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
index 2a3ae84bda346aff5dd57e5bc6ced500590c2b16..38aa20fbe614379231e244d847900562098e351d 100644 (file)
@@ -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
index 4310eb642e63d07bacd43981f3e3d03588a9e39c..a68c4fd9c1861bda6dbc6fabb50d36f8e36daa4c 100644 (file)
@@ -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
index 1f29c1cf74c8d4e73e63a532779cbf54c5759237..db6cf0983baebdb4471323c5a4eb36e2752d1133 100644 (file)
@@ -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
index 70d40b822002e76c97aecda613cac0d3506524c7..cfe47ee2643b922642ea977788928d3b0cbef574 100644 (file)
@@ -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
index e30cd673e58d80d8357bcdceba04af84e7048d64..4b3cfd117c5ce0f0d16fb61960e7cc6d80dfe806 100644 (file)
@@ -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
index ce0416b9223a7a97ffa20f0216fe15b24c2593c8..fc14e76e7188a9a4e252ffc2d8f16eb0df980da4 100644 (file)
@@ -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
index bc2b2b34545cd49028e9c9a2b4b5a04843722cb0..59d9f2f777d413bdd6c355b7fe8f896f4920ebef 100755 (executable)
@@ -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
index 9f7b3a090fa55acbae309e27b98cafcd538e7fda..f4a9c6461b1bff7cd1f9bbd260a3e9c8494fbda6 100755 (executable)
@@ -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
index fb6d952c415622555d3c27dbb4511e54936547bf..9113633451aa9c25261889fd682d99f464e9dfae 100755 (executable)
@@ -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
index d20b188abfbddedfa04f7459605b66aaaa7f0ce5..24621636b950b0ced6ecdf6a82d46807778b4bcf 100644 (file)
@@ -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
index 24ee22d6064434f7952be345c822f9247c8e0af8..308eca65c52479a856e4376cc33e62d6894f66e6 100644 (file)
@@ -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
index 619b238bd253d91b7c2e89d38d0a50ba62e80d81..908825e5f18df90fcbb825321509c69ae7d2ab43 100644 (file)
@@ -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
index 0120e550cdbdc7ea7faa6f0fbceb654accf3d0b1..fbe7558d13c1caada636fc5c829251fd0f31a2ed 100644 (file)
@@ -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
 
index 19397e15363b673ffe07475ec2683c4e52252bba..5375a7384d79a40877ca6a0e06b0b574f16b6dea 100644 (file)
@@ -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
 
index 0187f55c80161e5ff2eea2659e79b406c8f56643..8cfb3887c810fcd6e72118c16fa1f88802559e2b 100755 (executable)
        
                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');
        /**
         * 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;
                
index 6846303af72cdcaf5b81a032384eb645d19e2d6d..7b838a88a910ee646b7c23871867f2796ed0f0d1 100644 (file)
@@ -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)
index eecfdc37bd41b41383fa0e727df6e8bd27d2dcf8..1ce0350e1f1dc3add09384fcff6dad11a06517ac 100644 (file)
@@ -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
+?>
index c31e6181ed6723cf8b229905ac256e1dca17ed8d..617e92063fbbf9ca21257659dbaa627761da4fd8 100644 (file)
@@ -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;
        }