Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.16.14

Bug #2452 Admin/Perm/DB_Medium getGroups method broken
Submitted: 2004-10-04 21:14 UTC
From: tim at nonfiction dot ca Assigned: dufuz
Status: Closed Package: LiveUser
PHP Version: 4.3.6 OS: Mandrake 9
Roadmaps: (Not assigned)    
Subscription  


 [2004-10-04 21:14 UTC] tim at nonfiction dot ca
Description: ------------ Admin/Perm/Container/DB_Medium.php getGroups() method has an SQL Syntax error. Reproduce code: --------------- --- DB_Medium1.php Mon Oct 4 15:06:21 2004 +++ DB_Medium2.php Mon Oct 4 15:06:29 2004 @@ -586,33 +586,33 @@ ); if (isset($this->groupTableCols['optional']['group_type'])) { - $customFields[] = $this->groupTableCols['optional']['group_type']['name'] . ' AS group_type'; + $customFields[] = 'groups.' . $this->groupTableCols['optional']['group_type']['name'] . ' AS group_type'; } if (isset($this->groupTableCols['optional']['is_active'])) { - $customFields[] = "CASE {$this->groupTableCols['optional']['is_active']['name']} + $customFields[] = "CASE groups.{$this->groupTableCols['optional']['is_active']['name']} WHEN 'Y' THEN 1 WHEN 'N' THEN 0 END AS is_active"; } if (isset($this->groupTableCols['optional']['owner_user_id'])) { - $customFields[] = $this->groupTableCols['optional']['owner_user_id']['name'] . ' AS owner_user_id'; + $customFields[] = 'groups.' . $this->groupTableCols['optional']['owner_user_id']['name'] . ' AS owner_user_id'; } if (isset($this->groupTableCols['optional']['owner_group_id'])) { - $customFields[] = $this->groupTableCols['optional']['owner_group_id']['name'] . ' AS owner_group_id'; + $customFields[] = 'groups.' . $this->groupTableCols['optional']['owner_group_id']['name'] . ' AS owner_group_id'; } if (isset($this->groupTableCols['custom']) && sizeof($this->groupTableCols['custom']) > 0) { foreach ($this->groupTableCols['custom'] as $alias => $field_data) { - $customFields[] = $field_data['name'] . ' AS ' . $alias; + $customFields[] = 'groups.' . $field_data['name'] . ' AS ' . $alias; } } if (count($customFields) > 0) { $fields = ','; - $fields .= implode(', groups.', $customFields); + $fields .= implode(', ', $customFields); } $query = 'SELECT Expected result: ---------------- Should get back an array of groups. Actual result: -------------- Returns a DB Error object

Comments

 [2004-10-05 03:53 UTC] dufuz
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. Hi thanks for taking the time reporting this, but this has already been fixed in CVS (with identical fix as yours actually) and we'll release a new version very soon.