Re: Re: Liveuser - adding users problem
| From: | Jeroen Houben | Date: | Thu, 01 Sep 2005 11:55:14 +0000 |
| Subject: | Re: Re: Liveuser - adding users problem | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20718@lists.php.net to get a copy of this message | ||
Lukas Smith wrote:
Jeroen Houben wrote:CVS. Spent some debugging this and I got it work by making a small change. In SQL.php in the insert method, it starts with a foreach loop. function insert($table, $data) {$user = array(); $user['handle'] = 'handle_' . substr(md5(time()), 0, 25); $user['passwd'] = 'pwd_' . substr(md5(time()), 0, 12); $lu_admin->addUser($user); To SQL inserts are performed, which is good, but the problem is that the auth_user_id in the lu_user_perm table is set to the password used in the lu_users table. Whereas it should be set the to the value of auth_user_id of the lu_users table (I think!).Hmm dont really know whats going on here. Are you using CVS or 0.3.3?
// sanity checks
$sequence_id = false;
foreach ($this->tables[$table]['fields'] as $field => $required) {
if ($required) {
//if ($required == 'seq') { doesn't work, boolean (true) seems to enter this if statement (???)
if ($required === 'seq') {
if (!isset($data[$field])) {
$result = $this->getBeforeId($this->prefix . $this->alias[$table], true);
if ($result === false) {
return false;
}
$data[$field] = $sequence_id = $result;
} else {
$sequence_id = $data[$field];
}
} elseif (!isset($data[$field])) {
$this->_stack->push(
LIVEUSER_ADMIN_ERROR_QUERY_BUILDER, 'exception',
array('reason' => 'field may not be empty: '.$field)
);
return false;
}
}
}
I changed the if statement from if ($required == 'seq') to if ($required === 'seq')
It's really bizar and I don't know why, but if $required is set to TRUE, the IF statement evaluates to TRUE (?). Surely I must be doing something work, or overlooking something. Anyway, enforcing type checking fixes the problem.
Any ideas?
Jeroen