PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Authentication » LiveUser » Bug #942

Bug in isInactive()

Details

Submitted2004-03-04 06:09 UTC
Fromalain_d99 at freesurf dot ch
Assignedlsmith
StatusClosed
PackageLiveUser
PHP Version4.2.1
OSWindows
Roadmaps(Not assigned)

Comments

[2004-03-04 06:09 UTC] alain_d99 at freesurf dot ch

Description:
------------
Hello,

LiveUser.php: v1.79

The LiveUser::isInactive() function doesn't work as expected.

Example:
$nLiveUser =& LiveUser::factory($nConfig);
$nLiveUser->init();

if(!$nLiveUser->isLoggedIn()) {
if($nLiveUser->isInactive())
echo "Inactive";
else
echo "Active";
}

In the example above, the "Active" term is always printed, even if user has its "is_active" bit on 'N'.

The problem comes from the tryLogin() function at the end:
if (!$auth->isActive) {
$this->status = LIVEUSER_STATUS_ISINACTIVE;
$userFound = true;
}

it would be:
if (!$auth->isActive) {
$this->_auth = $auth; //ADDED
$this->status = LIVEUSER_STATUS_ISINACTIVE;
$userFound = true;
}

Now, LiveUser::isInactive() works perfectly well.

Thanks for your work,
Alain

Expected result:
----------------
LiveUser::isInactive() must return true if login is right and user has its "is_active" bit on 'N'.

Actual result:
--------------
LiveUser::isInactive() returns always false

[2004-03-06 08:58 UTC] alain_d99 at freesurf dot ch

Hello Smith,

the status variable is only intended to give a "status report" of a LiveUser function member, right?

If we write the following instructions, a problem arrives:
$nResult = $nLiveUser->init();
//Here status = LIVEUSER_STATUS_ISINACTIVE, Ok

$nLiveUser->totoFunction();
//Here status = LIVEUSER_STATUS_TOTO

if($nLiveUser->isInactive())
//Here, the inInactive function don't give the correct result even if the user has its "is_active" bit on 'N'.

the isInactive() function must give always the right result, even if some calls are made to another LiveUser function members.

Thank for your work, greetings,
Alain

[2004-03-08 12:31 UTC] alain_d99 at freesurf dot ch

Hello Smith,

you are right, your new isInactive() will be effectively sufficient if you don't introduce a new function that change the status variable (doesn't exist until now).

I understand that only init() and its subfunctions will change this variable, and status variable gives the right "status" of LiveUser instance. Then you can see the status everywhere until the next call of init() function.

But if you want to use your LIVEUSER_STATUS_ constants for another functions, then your will break the validity of your isInactive() function.

Then, I find your solution is good.

Thank for your work, and greetings,
Alain

PS: if status variable is sufficient, no need for expired and idled variables anymore, because of use of LIVEUSER_STATUS_IDLED/EXPIRED?