[Tickets #5086] Re: foreach with references in the tasklists.inc template
bugs at bugs.horde.org
bugs at bugs.horde.org
Fri Jun 1 09:05:41 UTC 2007
DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.
Ticket URL: http://bugs.horde.org/ticket/?id=5086
-----------------------------------------------------------------------
Ticket | 5086
Updated By | thomas.jarosch at intra2net.com
Summary | foreach with references in the tasklists.inc template
Queue | Nag
Version | HEAD
Type | Bug
State | No Feedback
Priority | 1. Low
Owners |
-----------------------------------------------------------------------
thomas.jarosch at intra2net.com (2007-06-01 02:05) wrote:
Here's the root of the problem: Let's say you have an array of references
to Horde_Share objects named $shares. When you now process the array via
foreach ($shares as $key => $share) {
$share->get('name')
}
it creates a copy of the share object if you access it like this.
Here's the proper fix:
foreach(array_keys($shares) as $id) {
$shares[$id]->get('name');
}
That fixed the share renaming (among other reference fixes) in mnemo,
which are going to be submitted soon. It's also the way Turba accesses the
shares.
More information about the bugs
mailing list