<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>foreach with references in the tasklists.inc template</title> 
  <pubDate>Thu, 09 Apr 2026 23:21:09 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/5086</link> 
  <atom:link rel="self" type="application/rss+xml" title="foreach with references in the tasklists.inc template" href="https://bugs.horde.org/ticket/5086/rss" /> 
  <description>foreach with references in the tasklists.inc template</description> 
 
   
   
  <item> 
   <title>The list of shares that is used within the tasklists.inc tem</title> 
   <description>The list of shares that is used within the tasklists.inc template is a list of references in my case (kolab share driver). 



The use of the two foreach loops within the templates mixes up these refernces and once I edit a share I end up with one shares being listed twice and other shares missing.



In case the share array should really be an array of references the attached patch would fix the problematic foreach loops. In case the share list should not provide object references, the driver would probably need to be modified accordingly.</description> 
   <pubDate>Thu, 08 Mar 2007 07:53:18 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5086#t30112</link> 
  </item> 
   
  <item> 
   <title>s/the driver would/the share driver would/</title> 
   <description>s/the driver would/the share driver would/</description> 
   <pubDate>Thu, 08 Mar 2007 07:54:17 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5086#t30113</link> 
  </item> 
   
  <item> 
   <title>This doesn&#039;t make a lot of sense to me. Even if it&#039;s an arra</title> 
   <description>This doesn&#039;t make a lot of sense to me. Even if it&#039;s an array of references, they&#039;re not changed in either loop, and you should be able to loop through it more than once. Is this a difference between the kolab and datatree drivers, or a PHP version thing?</description> 
   <pubDate>Thu, 08 Mar 2007 20:18:30 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5086#t30169</link> 
  </item> 
   
  <item> 
   <title>The issue that I had matched what is described here:



http</title> 
   <description>The issue that I had matched what is described here:



http://www.php.net/manual/en/control-structures.foreach.php#66000



and changing the way the iteration works in that template fixed the problem for me. But I don&#039;t know if that is dependant on the PHP version. I am using PHP-5.1.6 on the development machine.



I can do further testing with the PHP version and also compare to the datatree driver if that is required.</description> 
   <pubDate>Fri, 09 Mar 2007 08:38:03 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5086#t30194</link> 
  </item> 
   
  <item> 
   <title>But this loop doesn&#039;t even use references.</title> 
   <description>But this loop doesn&#039;t even use references.</description> 
   <pubDate>Fri, 09 Mar 2007 11:24:38 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5086#t30197</link> 
  </item> 
   
  <item> 
   <title>The problem still exists for me but I still need to investig</title> 
   <description>The problem still exists for me but I still need to investigate the correct source for the error and try to construct an example. I&#039;ll reopen it once I know more.</description> 
   <pubDate>Fri, 13 Apr 2007 15:26:40 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5086#t31599</link> 
  </item> 
   
  <item> 
   <title>Here&#039;s the root of the problem: Let&#039;s say you have an array </title> 
   <description>Here&#039;s the root of the problem: Let&#039;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 =&gt; $share) {

$share-&gt;get(&#039;name&#039;)

}



it creates a copy of the share object if you access it like this.



Here&#039;s the proper fix:



foreach(array_keys($shares) as $id) {

$shares[$id]-&gt;get(&#039;name&#039;);

}



That fixed the share renaming (among other reference fixes) in mnemo, which are going to be submitted soon. It&#039;s also the way Turba accesses the shares.

</description> 
   <pubDate>Fri, 01 Jun 2007 09:05:41 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5086#t33713</link> 
  </item> 
   
  <item> 
   <title>&gt; foreach ($shares as $key =&gt; $share) {

&gt; $share-&gt;get(&#039;name</title> 
   <description>&gt; foreach ($shares as $key =&gt; $share) {

&gt; $share-&gt;get(&#039;name&#039;)

&gt; }



btw: PHP5 supports references in foreach, but that&#039;s out of the question right now for Horde. Using PHP5 it can be written like this:



foreach ($shares as $key =&gt; &amp;$share) {

$share-&gt;get(&#039;name&#039;)

}

</description> 
   <pubDate>Fri, 01 Jun 2007 09:09:13 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5086#t33714</link> 
  </item> 
   
  <item> 
   <title>&gt; btw: PHP5 supports references in foreach, but that&#039;s out o</title> 
   <description>&gt; btw: PHP5 supports references in foreach, but that&#039;s out of the 

&gt; question right now for Horde. Using PHP5 it can be written like this:



With PHP 5 objects aren&#039;t copied unless you clone them, so none of this junk is necessary...</description> 
   <pubDate>Fri, 01 Jun 2007 14:38:49 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5086#t33730</link> 
  </item> 
   
  <item> 
   <title>I still don&#039;t understand how this results in not getting the</title> 
   <description>I still don&#039;t understand how this results in not getting the right values for read-only share access, but I&#039;ve committed it for now.</description> 
   <pubDate>Fri, 01 Jun 2007 14:55:42 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5086#t33733</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
