From: Robin Appelman Date: Sat, 16 Apr 2011 18:45:57 +0000 (+0200) Subject: more strict fixes for mdb2 X-Git-Tag: v3.0~267^2~558^2~131 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=519a84e0481b157d86d9fc676a66f7d4feda2c3a;p=nextcloud-server.git more strict fixes for mdb2 --- diff --git a/3dparty/MDB2.php b/3dparty/MDB2.php index ac54aabb6c6..e7be72babc7 100644 --- a/3dparty/MDB2.php +++ b/3dparty/MDB2.php @@ -340,7 +340,7 @@ class MDB2 } else { $msg = "unable to load class '$class_name' from file '$file_name'"; } - $err =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, $msg); + $err =MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, $msg); return $err; } } @@ -378,7 +378,7 @@ class MDB2 { $dsninfo = MDB2::parseDSN($dsn); if (empty($dsninfo['phptype'])) { - $err =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND, + $err =MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'no RDBMS driver specified'); return $err; } @@ -433,7 +433,7 @@ class MDB2 */ function &connect($dsn, $options = false) { - $db =& MDB2::factory($dsn, $options); + $db =MDB2::factory($dsn, $options); if (PEAR::isError($db)) { return $db; } @@ -497,10 +497,10 @@ class MDB2 } } } elseif (is_array($GLOBALS['_MDB2_databases']) && reset($GLOBALS['_MDB2_databases'])) { - $db =& $GLOBALS['_MDB2_databases'][key($GLOBALS['_MDB2_databases'])]; + $db =$GLOBALS['_MDB2_databases'][key($GLOBALS['_MDB2_databases'])]; return $db; } - $db =& MDB2::factory($dsn, $options); + $db =MDB2::factory($dsn, $options); return $db; } @@ -597,7 +597,7 @@ class MDB2 * @access private * @see PEAR_Error */ - function &raiseError($code = null, + static function raiseError($code = null, $mode = null, $options = null, $userinfo = null, @@ -605,7 +605,7 @@ class MDB2 $dummy2 = null, $dummy3 = false) { - $err =& PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true); + $err =PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true); return $err; } @@ -1000,7 +1000,7 @@ class MDB2_Error extends PEAR_Error * * @param mixed MDB2 error code, or string with error message. * @param int what 'error mode' to operate in - * @param int what error level to use for $mode & PEAR_ERROR_TRIGGER + * @param int what error level to use for $mode raPEAR_ERROR_TRIGGER * @param mixed additional debug info, such as the last query */ function MDB2_Error($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN, @@ -1457,7 +1457,7 @@ class MDB2_Driver_Common extends PEAR * @access public * @see PEAR_Error */ - function &raiseError($code = null, + static function &raiseError($code = null, $mode = null, $options = null, $userinfo = null, @@ -1501,7 +1501,7 @@ class MDB2_Driver_Common extends PEAR $err = PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true); if ($err->getMode() !== PEAR_ERROR_RETURN && isset($this->nested_transaction_counter) && !$this->has_transaction_error) { - $this->has_transaction_error =& $err; + $this->has_transaction_error =$err; } return $err; } @@ -1938,12 +1938,12 @@ class MDB2_Driver_Common extends PEAR } if (!MDB2::classExists($class_name)) { - $err =& $this->raiseError(MDB2_ERROR_LOADMODULE, null, null, + $err =$this->raiseError(MDB2_ERROR_LOADMODULE, null, null, "unable to load module '$module' into property '$property'", __FUNCTION__); return $err; } $this->{$property} = new $class_name($this->db_index); - $this->modules[$module] =& $this->{$property}; + $this->modules[$module] =$this->{$property}; if ($version) { // this will be used in the connect method to determine if the module // needs to be loaded with a different version if the server @@ -2447,7 +2447,7 @@ class MDB2_Driver_Common extends PEAR return $connection; } - $result =& $this->_doQuery($query, $is_manip, $connection, false); + $result =$this->_doQuery($query, $is_manip, $connection, false); if (PEAR::isError($result)) { return $result; } @@ -2456,7 +2456,7 @@ class MDB2_Driver_Common extends PEAR $affected_rows = $this->_affectedRows($connection, $result); return $affected_rows; } - $result =& $this->_wrapResult($result, $types, true, false, $limit, $offset); + $result =$this->_wrapResult($result, $types, true, false, $limit, $offset); return $result; } @@ -2504,7 +2504,7 @@ class MDB2_Driver_Common extends PEAR } $query = $result; } - $err =& $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + $err =$this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'method not implemented', __FUNCTION__); return $err; } @@ -2552,7 +2552,7 @@ class MDB2_Driver_Common extends PEAR return $connection; } - $result =& $this->_doQuery($query, true, $connection, $this->database_name); + $result =$this->_doQuery($query, true, $connection, $this->database_name); if (PEAR::isError($result)) { return $result; } @@ -2589,12 +2589,12 @@ class MDB2_Driver_Common extends PEAR return $connection; } - $result =& $this->_doQuery($query, false, $connection, $this->database_name); + $result =$this->_doQuery($query, false, $connection, $this->database_name); if (PEAR::isError($result)) { return $result; } - $result =& $this->_wrapResult($result, $types, $result_class, $result_wrap_class, $limit, $offset); + $result =$this->_wrapResult($result, $types, $result_class, $result_wrap_class, $limit, $offset); return $result; } @@ -2643,13 +2643,13 @@ class MDB2_Driver_Common extends PEAR if ($result_class) { $class_name = sprintf($result_class, $this->phptype); if (!MDB2::classExists($class_name)) { - $err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, + $err =$this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'result class does not exist '.$class_name, __FUNCTION__); return $err; } $result =new $class_name($this, $result, $limit, $offset); if (!MDB2::isResultCommon($result)) { - $err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, + $err =$this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'result class is not extended from MDB2_Result_Common', __FUNCTION__); return $err; } @@ -2666,7 +2666,7 @@ class MDB2_Driver_Common extends PEAR } if ($result_wrap_class) { if (!MDB2::classExists($result_wrap_class)) { - $err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, + $err =$this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'result wrap class does not exist '.$result_wrap_class, __FUNCTION__); return $err; } @@ -2877,7 +2877,7 @@ class MDB2_Driver_Common extends PEAR $condition = ' WHERE '.implode(' AND ', $condition); $query = 'DELETE FROM ' . $this->quoteIdentifier($table, true) . $condition; - $result =& $this->_doQuery($query, true, $connection); + $result =$this->_doQuery($query, true, $connection); if (!PEAR::isError($result)) { $affected_rows = $this->_affectedRows($connection, $result); $insert = ''; @@ -2886,7 +2886,7 @@ class MDB2_Driver_Common extends PEAR } $values = implode(', ', $values); $query = 'INSERT INTO '. $this->quoteIdentifier($table, true) . "($insert) VALUES ($values)"; - $result =& $this->_doQuery($query, true, $connection); + $result =$this->_doQuery($query, true, $connection); if (!PEAR::isError($result)) { $affected_rows += $this->_affectedRows($connection, $result);; } @@ -2996,7 +2996,7 @@ class MDB2_Driver_Common extends PEAR $regexp = '/^.{'.($position+1).'}('.$this->options['bindname_format'].').*$/s'; $parameter = preg_replace($regexp, '\\1', $query); if ($parameter === '') { - $err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null, + $err =$this->raiseError(MDB2_ERROR_SYNTAX, null, null, 'named parameter name must match "bindname_format" option', __FUNCTION__); return $err; } @@ -3054,7 +3054,7 @@ class MDB2_Driver_Common extends PEAR if ($ignore['end'] === "\n") { $end_quote = strlen($query) - 1; } else { - $err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null, + $err =$this->raiseError(MDB2_ERROR_SYNTAX, null, null, 'query with an unterminated text string specified', __FUNCTION__); return $err; } @@ -3446,8 +3446,8 @@ class MDB2_Result_Common extends MDB2_Result */ function __construct(&$db, &$result, $limit = 0, $offset = 0) { - $this->db =& $db; - $this->result =& $result; + $this->db =$db; + $this->result =$result; $this->offset = $offset; $this->limit = max(0, $limit - 1); } @@ -3541,7 +3541,7 @@ class MDB2_Result_Common extends MDB2_Result */ function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null) { - $err =& $this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + $err =$this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'method not implemented', __FUNCTION__); return $err; } @@ -3846,7 +3846,7 @@ class MDB2_Result_Common extends MDB2_Result } $column = $column_names[$column]; } - $this->values[$column] =& $value; + $this->values[$column] =$value; if (!is_null($type)) { $this->types[$column] = $type; } @@ -3969,8 +3969,8 @@ class MDB2_Statement_Common */ function __construct(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null) { - $this->db =& $db; - $this->statement =& $statement; + $this->db =$db; + $this->statement =$statement; $this->positions = $positions; $this->query = $query; $this->types = (array)$types; @@ -4085,7 +4085,7 @@ class MDB2_Statement_Common return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'Unable to bind to missing placeholder: '.$parameter, __FUNCTION__); } - $this->values[$parameter] =& $value; + $this->values[$parameter] =$value; if (!is_null($type)) { $this->types[$parameter] = $type; } @@ -4152,7 +4152,7 @@ class MDB2_Statement_Common 'Binding Values failed with message: ' . $err->getMessage(), __FUNCTION__); } } - $result =& $this->_execute($result_class, $result_wrap_class); + $result =$this->_execute($result_class, $result_wrap_class); return $result; } @@ -4200,7 +4200,7 @@ class MDB2_Statement_Common if ($this->is_manip) { $result = $this->db->exec($query); } else { - $result =& $this->db->query($query, $this->result_types, $result_class, $result_wrap_class); + $result =$this->db->query($query, $this->result_types, $result_class, $result_wrap_class); } return $result; } @@ -4296,9 +4296,9 @@ class MDB2_Module_Common function &getDBInstance() { if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) { - $result =& $GLOBALS['_MDB2_databases'][$this->db_index]; + $result =$GLOBALS['_MDB2_databases'][$this->db_index]; } else { - $result =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, + $result =MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'could not find MDB2 instance'); } return $result; diff --git a/3dparty/PEAR.php b/3dparty/PEAR.php index 9760b9d265a..a3dadfe8bb1 100644 --- a/3dparty/PEAR.php +++ b/3dparty/PEAR.php @@ -492,7 +492,7 @@ class PEAR * @see PEAR::setErrorHandling * @since PHP 4.0.5 */ - function raiseError($message = null, + static function raiseError($message = null, $code = null, $mode = null, $options = null,