From 3158f9c33a1107c4b0d69faaa6ba1f7501d8aa76 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 10 Jul 2017 13:33:11 +0200 Subject: [PATCH] Update PEAR DB to 1.9.2 Source: https://pear.php.net/package/DB Release date: 2015-11-24 --- extlib/DB.php | 34 ++++++++++++++++++++++++---------- extlib/DB/common.php | 4 ++-- extlib/DB/dbase.php | 8 ++++---- extlib/DB/fbsql.php | 8 ++++---- extlib/DB/ibase.php | 8 ++++---- extlib/DB/ifx.php | 8 ++++---- extlib/DB/msql.php | 8 ++++---- extlib/DB/mssql.php | 8 ++++---- extlib/DB/mysql.php | 8 ++++---- extlib/DB/mysqli.php | 18 +++++++++++++----- extlib/DB/oci8.php | 8 ++++---- extlib/DB/odbc.php | 8 ++++---- extlib/DB/pgsql.php | 8 ++++---- extlib/DB/sqlite.php | 8 ++++---- extlib/DB/storage.php | 4 ++-- extlib/DB/sybase.php | 8 ++++---- 16 files changed, 89 insertions(+), 67 deletions(-) diff --git a/extlib/DB.php b/extlib/DB.php index b9b5c4a79f..cfbbe5ed2a 100644 --- a/extlib/DB.php +++ b/extlib/DB.php @@ -426,7 +426,7 @@ define('DB_PORTABILITY_ALL', 63); * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB */ class DB @@ -577,7 +577,7 @@ class DB */ function apiVersion() { - return '1.8.2'; + return '1.9.2'; } // }}} @@ -941,7 +941,7 @@ class DB * @author Stig Bakken * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB */ class DB_Error extends PEAR_Error @@ -959,18 +959,32 @@ class DB_Error extends PEAR_Error * * @see PEAR_Error */ - function DB_Error($code = DB_ERROR, $mode = PEAR_ERROR_RETURN, + function __construct($code = DB_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null) { if (is_int($code)) { - $this->PEAR_Error('DB Error: ' . DB::errorMessage($code), $code, + parent::__construct('DB Error: ' . DB::errorMessage($code), $code, $mode, $level, $debuginfo); } else { - $this->PEAR_Error("DB Error: $code", DB_ERROR, + parent::__construct("DB Error: $code", DB_ERROR, $mode, $level, $debuginfo); } } + /** + * Workaround to both avoid the "Redefining already defined constructor" + * PHP error and provide backward compatibility in case someone is calling + * DB_Error() dynamically + */ + public function __call($method, $arguments) + { + if ($method == 'DB_Error') { + return call_user_func_array(array($this, '__construct'), $arguments); + } + trigger_error( + 'Call to undefined method DB_Error::' . $method . '()', E_USER_ERROR + ); + } // }}} } @@ -988,7 +1002,7 @@ class DB_Error extends PEAR_Error * @author Stig Bakken * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB */ class DB_result @@ -1095,7 +1109,7 @@ class DB_result * * @return void */ - function DB_result(&$dbh, $result, $options = array()) + function __construct(&$dbh, $result, $options = array()) { $this->autofree = $dbh->options['autofree']; $this->dbh = &$dbh; @@ -1453,7 +1467,7 @@ class DB_result * @author Stig Bakken * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB * @see DB_common::setFetchMode() */ @@ -1468,7 +1482,7 @@ class DB_row * * @return void */ - function DB_row(&$arr) + function __construct(&$arr) { foreach ($arr as $key => $value) { $this->$key = &$arr[$key]; diff --git a/extlib/DB/common.php b/extlib/DB/common.php index 27829a072a..73e3eb69f7 100644 --- a/extlib/DB/common.php +++ b/extlib/DB/common.php @@ -42,7 +42,7 @@ require_once 'PEAR.php'; * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB */ class DB_common extends PEAR @@ -145,7 +145,7 @@ class DB_common extends PEAR * * @return void */ - function DB_common() + function __construct() { $this->PEAR('DB_Error'); } diff --git a/extlib/DB/dbase.php b/extlib/DB/dbase.php index df36f972e3..17750cd5d2 100644 --- a/extlib/DB/dbase.php +++ b/extlib/DB/dbase.php @@ -41,7 +41,7 @@ require_once 'DB/common.php'; * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB */ class DB_dbase extends DB_common @@ -140,13 +140,13 @@ class DB_dbase extends DB_common // {{{ constructor /** - * This constructor calls $this->DB_common() + * This constructor calls parent::__construct() * * @return void */ - function DB_dbase() + function __construct() { - $this->DB_common(); + parent::__construct(); } // }}} diff --git a/extlib/DB/fbsql.php b/extlib/DB/fbsql.php index b719da38e2..c32a08d120 100644 --- a/extlib/DB/fbsql.php +++ b/extlib/DB/fbsql.php @@ -41,7 +41,7 @@ require_once 'DB/common.php'; * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB * @since Class functional since Release 1.7.0 */ @@ -124,13 +124,13 @@ class DB_fbsql extends DB_common // {{{ constructor /** - * This constructor calls $this->DB_common() + * This constructor calls parent::__construct() * * @return void */ - function DB_fbsql() + function __construct() { - $this->DB_common(); + parent::__construct(); } // }}} diff --git a/extlib/DB/ibase.php b/extlib/DB/ibase.php index 209ac6c3a1..60e07b5fc3 100644 --- a/extlib/DB/ibase.php +++ b/extlib/DB/ibase.php @@ -49,7 +49,7 @@ require_once 'DB/common.php'; * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB * @since Class became stable in Release 1.7.0 */ @@ -180,13 +180,13 @@ class DB_ibase extends DB_common // {{{ constructor /** - * This constructor calls $this->DB_common() + * This constructor calls parent::__construct() * * @return void */ - function DB_ibase() + function __construct() { - $this->DB_common(); + parent::__construct(); } // }}} diff --git a/extlib/DB/ifx.php b/extlib/DB/ifx.php index e3150f92fb..5c5709f79e 100644 --- a/extlib/DB/ifx.php +++ b/extlib/DB/ifx.php @@ -48,7 +48,7 @@ require_once 'DB/common.php'; * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB */ class DB_ifx extends DB_common @@ -167,13 +167,13 @@ class DB_ifx extends DB_common // {{{ constructor /** - * This constructor calls $this->DB_common() + * This constructor calls parent::__construct() * * @return void */ - function DB_ifx() + function __construct() { - $this->DB_common(); + parent::__construct(); } // }}} diff --git a/extlib/DB/msql.php b/extlib/DB/msql.php index c303bb9067..adcedf7a07 100644 --- a/extlib/DB/msql.php +++ b/extlib/DB/msql.php @@ -47,7 +47,7 @@ require_once 'DB/common.php'; * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB * @since Class not functional until Release 1.7.0 */ @@ -126,13 +126,13 @@ class DB_msql extends DB_common // {{{ constructor /** - * This constructor calls $this->DB_common() + * This constructor calls parent::__construct() * * @return void */ - function DB_msql() + function __construct() { - $this->DB_common(); + parent::__construct(); } // }}} diff --git a/extlib/DB/mssql.php b/extlib/DB/mssql.php index e25caf144e..d68ebfa61e 100644 --- a/extlib/DB/mssql.php +++ b/extlib/DB/mssql.php @@ -49,7 +49,7 @@ require_once 'DB/common.php'; * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB */ class DB_mssql extends DB_common @@ -179,13 +179,13 @@ class DB_mssql extends DB_common // {{{ constructor /** - * This constructor calls $this->DB_common() + * This constructor calls parent::__construct() * * @return void */ - function DB_mssql() + function __construct() { - $this->DB_common(); + parent::__construct(); } // }}} diff --git a/extlib/DB/mysql.php b/extlib/DB/mysql.php index 21132d62df..ffefbc49fd 100644 --- a/extlib/DB/mysql.php +++ b/extlib/DB/mysql.php @@ -41,7 +41,7 @@ require_once 'DB/common.php'; * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB */ class DB_mysql extends DB_common @@ -162,13 +162,13 @@ class DB_mysql extends DB_common // {{{ constructor /** - * This constructor calls $this->DB_common() + * This constructor calls parent::__construct() * * @return void */ - function DB_mysql() + function __construct() { - $this->DB_common(); + parent::__construct(); } // }}} diff --git a/extlib/DB/mysqli.php b/extlib/DB/mysqli.php index 5f081f7c4f..4f56f0fdac 100644 --- a/extlib/DB/mysqli.php +++ b/extlib/DB/mysqli.php @@ -43,7 +43,7 @@ require_once 'DB/common.php'; * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB * @since Class functional since Release 1.6.3 */ @@ -224,13 +224,13 @@ class DB_mysqli extends DB_common // {{{ constructor /** - * This constructor calls $this->DB_common() + * This constructor calls parent::__construct() * * @return void */ - function DB_mysqli() + function __construct() { - $this->DB_common(); + parent::__construct(); } // }}} @@ -497,7 +497,11 @@ class DB_mysqli extends DB_common */ function freeResult($result) { - return is_resource($result) ? mysqli_free_result($result) : false; + if (! $result instanceof mysqli_result) { + return false; + } + mysqli_free_result($result); + return true; } // }}} @@ -1031,6 +1035,10 @@ class DB_mysqli extends DB_common ? $this->mysqli_types[$tmp->type] : 'unknown', // http://bugs.php.net/?id=36579 + // Doc Bug #36579: mysqli_fetch_field length handling + // https://bugs.php.net/bug.php?id=62426 + // Bug #62426: mysqli_fetch_field_direct returns incorrect + // length on UTF8 fields 'len' => $tmp->length, 'flags' => $flags, ); diff --git a/extlib/DB/oci8.php b/extlib/DB/oci8.php index 9685c60e0c..1ca7a04e22 100644 --- a/extlib/DB/oci8.php +++ b/extlib/DB/oci8.php @@ -47,7 +47,7 @@ require_once 'DB/common.php'; * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB */ class DB_oci8 extends DB_common @@ -173,13 +173,13 @@ class DB_oci8 extends DB_common // {{{ constructor /** - * This constructor calls $this->DB_common() + * This constructor calls parent::__construct() * * @return void */ - function DB_oci8() + function __construct() { - $this->DB_common(); + parent::__construct(); } // }}} diff --git a/extlib/DB/odbc.php b/extlib/DB/odbc.php index 75d4fe74ff..a33406a654 100644 --- a/extlib/DB/odbc.php +++ b/extlib/DB/odbc.php @@ -44,7 +44,7 @@ require_once 'DB/common.php'; * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB */ class DB_odbc extends DB_common @@ -153,13 +153,13 @@ class DB_odbc extends DB_common // {{{ constructor /** - * This constructor calls $this->DB_common() + * This constructor calls parent::__construct() * * @return void */ - function DB_odbc() + function __construct() { - $this->DB_common(); + parent::__construct(); } // }}} diff --git a/extlib/DB/pgsql.php b/extlib/DB/pgsql.php index adfd6bf0a4..098d9f040a 100644 --- a/extlib/DB/pgsql.php +++ b/extlib/DB/pgsql.php @@ -43,7 +43,7 @@ require_once 'DB/common.php'; * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB */ class DB_pgsql extends DB_common @@ -148,13 +148,13 @@ class DB_pgsql extends DB_common // {{{ constructor /** - * This constructor calls $this->DB_common() + * This constructor calls parent::__construct() * * @return void */ - function DB_pgsql() + function __construct() { - $this->DB_common(); + parent::__construct(); } // }}} diff --git a/extlib/DB/sqlite.php b/extlib/DB/sqlite.php index 7adfb4c475..9c5c8b3523 100644 --- a/extlib/DB/sqlite.php +++ b/extlib/DB/sqlite.php @@ -47,7 +47,7 @@ require_once 'DB/common.php'; * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB */ class DB_sqlite extends DB_common @@ -152,13 +152,13 @@ class DB_sqlite extends DB_common // {{{ constructor /** - * This constructor calls $this->DB_common() + * This constructor calls parent::__construct() * * @return void */ - function DB_sqlite() + function __construct() { - $this->DB_common(); + parent::__construct(); } // }}} diff --git a/extlib/DB/storage.php b/extlib/DB/storage.php index 9ac23c825e..640d86f2b9 100644 --- a/extlib/DB/storage.php +++ b/extlib/DB/storage.php @@ -38,7 +38,7 @@ require_once 'DB.php'; * @author Stig Bakken * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB */ class DB_storage extends PEAR @@ -94,7 +94,7 @@ class DB_storage extends PEAR * a reference to this object * */ - function DB_storage($table, $keycolumn, &$dbh, $validator = null) + function __construct($table, $keycolumn, &$dbh, $validator = null) { $this->PEAR('DB_Error'); $this->_table = $table; diff --git a/extlib/DB/sybase.php b/extlib/DB/sybase.php index d87b18caab..14d054b246 100644 --- a/extlib/DB/sybase.php +++ b/extlib/DB/sybase.php @@ -46,7 +46,7 @@ require_once 'DB/common.php'; * @author Daniel Convissor * @copyright 1997-2007 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version Release: 1.8.2 + * @version Release: 1.9.2 * @link http://pear.php.net/package/DB */ class DB_sybase extends DB_common @@ -141,13 +141,13 @@ class DB_sybase extends DB_common // {{{ constructor /** - * This constructor calls $this->DB_common() + * This constructor calls parent::__construct() * * @return void */ - function DB_sybase() + function __construct() { - $this->DB_common(); + parent::__construct(); } // }}}