Page MenuHomePhabricator

GlobalAuth.php code review
Closed, ResolvedPublic

Description

Author: alno

Description:
patch supposed to correct the bug found

Bug found while checking the code with Eclipse 3.3


Version: unspecified
Severity: trivial

Attached:

Details

Reference
bz12270

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:59 PM
bzimport set Reference to bz12270.
bzimport added a subscriber: Unknown Object (MLST).

Could you please check if

@@ -92,7 +92,7 @@

			$fname );
		while( $row = $dbr->fetchObject( $res ) ) {
			if ( $row->user_wiki == $this->thiswiki || $row->user_wiki == '*' ) {
  • if ( $row->user_password == wfEncryptPassword( $row->$user_id, $password ) ) {

+ if ( $row->user_password == wfEncryptPassword( $row->userId, $password ) ) {

is really right? It's inconsistent to line 279.

Thanks.

robert wrote:

This cannot be (In reply to comment #1)

Could you please check if
@@ -92,7 +92,7 @@

        $fname );
while( $row = $dbr->fetchObject( $res ) ) {
        if ( $row->user_wiki == $this->thiswiki ||

$row->user_wiki == '*' ) {

  • if ( $row->user_password == wfEncryptPassword(

$row->$user_id, $password ) ) {
+ if ( $row->user_password == wfEncryptPassword(
$row->userId, $password ) ) {
is really right? It's inconsistent to line 279.
Thanks.

This cannot be correct given that the user id column in the user table is user_id not userId, therefore this line should be changed to

if ( $row->user_password == wfEncryptPassword( $row->user_id, $password ) ) {

Simply removing the second $ from $row->$user_id would fix this problem - although I believe that this is already acceptable syntax anyway, but better be on the safe side and probably generates some sort of error. Keeping second $ symbols out of object variable references also helps standardise code, but even so this may be a very minor issue.

Modified per comment #2 and applied with r30660.