6.0.0-beta6
▾
Tasks
New Task
Search
Photos
Wiki
▾
Tickets
New Ticket
Search
dev.horde.org
Toggle Alerts Log
Help
4/10/26
H
istory
A
ttachments
C
omment
W
atch
Download
Comment on [#6569] Restrict Comment To: groups lose group id when rendered
*
Your Email Address
*
Spam protection
Enter the letters below:
.__..__ . ..___.. [__][__)|\/| _/ | | || \| |./__.|___
Comment
> In lib/Forms/EditTicket.php, the comment restriction code goes like > this (I've annotated, as the code isn't commented): > > // get all the groups I can access in array (group_id => label, ...) format > > foreach (array_keys($mygroups) as $gid) { > > $grouplist[$gid] = $groups->getGroupName($gid, true); > > } > > // sort those by name > > asort($grouplist); > > // tack "Any Group" onto the front > > $grouplist = array_merge(array(0 => _("Any Group")), $grouplist); > > // push into the form > > $this->addVariable(_("Restrict Comment to:"), 'group', 'enum', true, > false, null, array($grouplist)); > > > > The intent of this code seems to be to create the drop-down for > restricting comments using the group ID (from the data tree) as the > option value and the group Name (also from the data tree) as the > option label. > > > > However, array_merge() screws that up, because PHP 5 & PHP 4 re-index > the array, destroying the key association needed: > > [bishop@predator staging]$ cat array_merge.php > > <?php > > $a = array (23 => 'Hello', '42' => 'World'); > > $a = array_merge(array (0 => 'I say, '), $a); > > var_dump($a); > > ?> > > [bishop@predator staging]$ php-5.2.5 array_merge.php > > array(3) { > > [0]=> > > string(7) "I say, " > > [1]=> > > string(5) "Hello" > > [2]=> > > string(5) "World" > > } > > [bishop@predator staging]$ php-4.4.7 array_merge.php > > array(3) { > > [0]=> > > string(7) "I say, " > > [1]=> > > string(5) "Hello" > > [2]=> > > string(5) "World" > > } > > > > My suggested patch (attached) is to replace array_merge() with the > plus operator. > >
Attachment
Watch this ticket
N
ew Ticket
M
y Tickets
S
earch
Q
uery Builder
R
eports
Saved Queries
Open Bugs
Bugs waiting for Feedback
Open Bugs in Releases
Open Enhancements
Enhancements waiting for Feedback
Bugs with Patches
Enhancements with Patches
Release Showstoppers
Stalled Tickets
New Tickets
Horde 5 Showstoppers