PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Authentication » LiveUser » Bug #1958

variable "typo" in Admin/Auth/Container/DB.php

Details

Submitted2004-07-22 20:39 UTC
Fromtschlottke at virtualminds dot de
Assignedlsmith
StatusClosed
PackageLiveUser
PHP Version5.0.0
OSdebian
Roadmaps(Not assigned)

Comments

[2004-07-22 20:39 UTC] tschlottke at virtualminds dot de

Description:
------------
there is an error in the getUsers method, line 405:

if (isset($this->authTableCols['is_active'])) {

it should be:

if (isset($this->authTableCols['optional']['is_active'])) {

[2004-07-22 20:53 UTC] tschlottke at virtualminds dot de

Correction: it isn't only this typo, the whole thing is broken, here's the correct method:
function getUsers($filters = array(), $order = null, $rekey = false)
{
if (!$this->init_ok) {
return false;
}

$fields = $where = '';

if (isset($this->authTableCols['optional']['lastlogin'])) {
$cFields[] = $this->authTableCols['optional']['lastlogin']['name'] . ' AS lastlogin';
}

if (isset($this->authTableCols['optional']['is_active'])) {
$cFields[] = "CASE {$this->authTableCols['optional']['is_active']['name']}
WHEN 'Y' THEN 1
WHEN 'N' THEN 0 END
AS is_active";
}

if (isset($this->authTableCols['owner_user_id'])) {
$cFields[] = $this->authTableCols['optional']['owner_user_id']['name'] . ' AS owner_user_id';
}

if (isset($this->authTableCols['owner_group_id'])) {
$cFields[] = $this->authTableCols['optional']['owner_group_id']['name'] . ' AS owner_group_id';
}

if (sizeof($this->authTableCols['custom']) > 0) {
foreach ($this->authTableCols['custom'] as $alias => $field_data) {
$cFields[] = $field_data['name'] . ' AS ' . $alias;
}
}
if(is_array($cFields)) {
$fields = ',';
$fields .= implode(',', $cFields);

}

if (sizeof($filters) > 0) {
$where = ' WHERE';
foreach ($filters as $f => $v) {
if (is_array($v)) {
$cond = ' ' . $v['cond'];
$where .= ' ' . $f . $v['op'] . $this->dbc->quoteSmart($v['value']) . $cond;
} else {
$cond = ' AND';
$where .= " $f=$v" . $cond;
}
}
$where = substr($where, 0, -(strlen($cond)));
}

if (!is_null($order)) {
$order = ' ORDER BY ' . $order;
}

// First: Get all data from auth table.
$query = '
SELECT
' . $this->authTableCols['required']['auth_user_id']['name'] . ' AS auth_user_id,
' . $this->authTableCols['required']['handle']['name'] . ' AS handle,
' . $this->authTableCols['required']['passwd']['name'] . ' AS passwd
' . $fields . '
FROM
' . $this->authTable
. $where
. $order;

if ($rekey) {
$res = $this->dbc->getAssoc($query, false, array(), DB_FETCHMODE_ASSOC);
} else {
$res = $this->dbc->getAll($query, array(), DB_FETCHMODE_ASSOC);
}

return $res;
}
}

[2004-07-23 08:59 UTC] smith at backendmedia dot com

I forgot to note that I gfixed this issue in the MDB2 container already with my last commit. So in theory someone just needs to port over those fixes.

[2004-07-31 10:12 UTC] smith at backendmedia dot com

This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.

In case this was a pear.php.net website problem, the change will show
up on the website in short time.

Thank you for the report, and for helping us make PEAR better.