Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop nextObject, don't make sense #1939

Merged
merged 1 commit into from
Mar 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions inc/auth.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ function userExists($options=array()) {
return 0;
} else {
// Get the first result...
$row = $result->nextObject();
$row = $result->next();

// Check if we have a password...
if (empty($row->password)) {
if (empty($row['password'])) {
//If the user has an LDAP DN, then store it in the Auth object
if ($row->user_dn) {
$this->user_dn = $row->user_dn;
if ($row['user_dn']) {
$this->user_dn = $row['user_dn'];
}
return 2;

Expand Down Expand Up @@ -343,13 +343,13 @@ function connection_db($name, $password) {

// Have we a result ?
if ($result->numrows() == 1) {
$row = $result->nextObject();
$password_db = $row->password;
$row = $result->next();
$password_db = $row['password'];

if (self::checkPassword($password, $password_db)) {
// Update password if needed
if (self::needRehash($password_db)) {
$input['id'] = $row->id;
$input['id'] = $row['id'];
// Set glpiID to allow password update
$_SESSION['glpiID'] = $input['id'];
$input['password'] = $password;
Expand Down
29 changes: 2 additions & 27 deletions inc/dbmysql.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1055,40 +1055,15 @@ public function key() {
}

/**
* Return next row of query results [FETCH_ASSOC]
* Return next row of query results
*
* @return string[]|null fetch_assoc() of first results row
*/
public function nextAssoc() {
if (!$this->res) {
return false;
}
$this->row = $this->conn->fetch_assoc($this->res);
return $this->row;
}

/**
* Get next result
*
* @see nextAssoc()
* Mandatory to keep, see http://php.net/iterator
*
* @return mixed
*/
public function next() {
return $this->nextAssoc();
}

/**
* OOP - Next row of query result
*
* @return object
*/
public function nextObject() {
if (!$this->res) {
return false;
}
$this->row = $this->conn->fetch_object($this->res);
$this->row = $this->conn->fetch_assoc($this->res);
return $this->row;
}

Expand Down