Home » Authentication » Auth_HTTP » Bug #3630
getAuthData fails due to session var rename
Details
| Submitted | 2005-02-28 02:34 UTC |
|---|---|
| From | daniel at chaosengine dot net |
| Assigned | hirokawa |
| Status | Closed |
| Package | Auth_HTTP |
| PHP Version | 4.3.10 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2005-02-28 02:34 UTC] daniel at chaosengine dot net
Description:
------------
Auth 1.2.3
Auth_HTTP 2.1.4
on line 325 of Auth/HTTP.php in function assignData the session name is changed.
however it's done after the Auth constructor is called
this causes getAuthData to fail.
commenting out line 325 fixes the problem (though it probably breaks something else =)
Reproduce code:
---------------
$config['authEngine'] = "DB";
$config['authDBOptions'] = array(
'table'=>"users",
'usernamecol'=>"username",
'passwordcol'=>"password",
'cryptType'=> "none",
'db_fields'=> "*",
);
$this->auth = new Auth_HTTP($config['authEngine'], $authOptions);
$this->auth->start();
if($this->auth->getAuth()) {
$this->username=$this->auth->getUsername();
$this->securityLevel=$this->auth->getAuthData('securityLevel');
} else {
die("Authentication failed");
}
var_dump($_SESSION);
Expected result:
----------------
array(2) {
["_authsession"]=>
array(5) {
["data"]=>
array(3) {
["id"]=>
string(1) "8"
["fullName"]=>
string(10) "John Doe"
["securityLevel"]=>
string(3) "100"
}
["registered"]=>
bool(true)
["username"]=>
string(6) "johnd"
["timestamp"]=>
int(1109557589)
["idle"]=>
int(1109557589)
}
}
Actual result:
--------------
getAuthData now fails as the are two arrays with the auth data split between them.
array(2) {
["_authsession"]=>
array(1) {
["data"]=>
array(3) {
["id"]=>
string(1) "1"
["fullName"]=>
string(14) "John Doe"
["securityLevel"]=>
string(5) "100"
}
}
["_authhttpb703e95377d3ff29f094d1c9ef888eeb"]=>
array(5) {
["data"]=>
array(0) {
}
["registered"]=>
bool(true)
["username"]=>
string(7) "johnd"
["timestamp"]=>
int(1109555234)
["idle"]=>
int(1109555524)
}
}
[2005-03-02 04:50 UTC] pear at sapphire dot no
I'm experiencing the same problem after upgrading to Auth_HTTP 2.1.4 from 2.0.
This error is the same as bug #1497 and as I commented on that bug: The error appeard first in CVS version 1.14. This patch fixes this problem.
--- HTTP.php.orig 2005-02-26 21:19:29.000000000 +0100
+++ HTTP.php 2005-02-26 22:27:34.000000000 +0100
@@ -323,6 +323,7 @@
* for distinct realms
*/
$this->_sessionName = "_authhttp".md5($this->realm);
+ $this->storage->_auth_obj->_sessionName =& $this->_sessionName;
}
// }}}