<?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>address auto-completion returns all addresses of address book</title> 
  <pubDate>Fri, 10 Apr 2026 15:00:36 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/13152</link> 
  <atom:link rel="self" type="application/rss+xml" title="address auto-completion returns all addresses of address book" href="https://bugs.horde.org/ticket/13152/rss" /> 
  <description>address auto-completion returns all addresses of address book</description> 
 
   
   
  <item> 
   <title>Using Horde (latest PEAR as of today),dynamic view. Kolab ba</title> 
   <description>Using Horde (latest PEAR as of today),dynamic view. Kolab back-end, browser is Firefox 26.0 / Linux

Every time I  log in to Horde: When creating a new mail, auto-completing of the address field will return *all* addresses of the database, not only the matching entries. Matching entries are highlighted, but can easily get lot in the long list of results.

This happens no matter how the user setting &quot;webmail/create new message/address book/show all contacts&quot; is set (checked/unchecked). Toggling that setting (even if from unchecked to checked) and saving the settings will make future actions return only the matching entries... until I log in the next time - I will again get the full list of addresses, no matter how that setting is set.

Repeatable 100%.</description> 
   <pubDate>Wed, 30 Apr 2014 09:28:09 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/13152#t83477</link> 
  </item> 
   
  <item> 
   <title>Can&#039;t reproduce.  Sounds more like a Turba issue anyway.</title> 
   <description>Can&#039;t reproduce.  Sounds more like a Turba issue anyway.</description> 
   <pubDate>Wed, 30 Apr 2014 21:47:55 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/13152#t83481</link> 
  </item> 
   
  <item> 
   <title>&gt; Can&#039;t reproduce.  Sounds more like a Turba issue anyway.
</title> 
   <description>&gt; Can&#039;t reproduce.  Sounds more like a Turba issue anyway.

how should I proceed?

a  - can you move this ticket to Turba or do I need to re-open another ticket?

b - I&#039;m again willing to debug on my end, but again could use a helping hand:

What I see is a POST request &quot;https://myserver.com/horde/services/ajax.php/horde/imple?token=sometoken&amp;app=imp&amp;imple=IMP_Ajax_Imple_ContactAutoCompleter&amp;input=to&amp;to=Angl&quot; (obviously, I typed in &quot;Angl&quot;), and a  return with 820 addresses.... much more that the 50 that are given as default for &quot;&quot;...

This seems to be a server-side thing: Initially, I get the complete list (no matter how the user preference is set), once I save the user preference, I get only the matching results reported via AJAX - no matter how I set the value of the &quot;return all contacts&quot; preference or how often I set it (test: one tab with &quot;new mail&quot; dialog, on tab open with the webmail user preference - I toggle the pref, save, then enter some chars in the &quot;to&quot; field of the new message. The ALAX call gets sent and returns all matches, no matter what preference I just set).

What file should I look at? The entry point seems to be IMP, I feel I should debug whether the autocomplete handler sees that user preference value and if so, where it comes from. lib/Ajax/Imple/ContactAutoCompleter.php seemed to be the right place - but it wasn&#039;t obvious to me that this actually contains the code to handle the AJAX call?

Regards,
Jens</description> 
   <pubDate>Thu, 01 May 2014 14:51:29 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/13152#t83486</link> 
  </item> 
   
  <item> 
   <title>&gt;&gt; Can&#039;t reproduce.  Sounds more like a Turba issue anyway.</title> 
   <description>&gt;&gt; Can&#039;t reproduce.  Sounds more like a Turba issue anyway.
&gt;
&gt; how should I proceed?
&gt;
&gt; a  - can you move this ticket to Turba or do I need to re-open 
&gt; another ticket?

Once its verified as an issue in Turba, I can move it.

&gt; b - I&#039;m again willing to debug on my end, but again could use a helping hand:
&gt;
&gt; What I see is a POST request 
&gt; &quot;https://myserver.com/horde/services/ajax.php/horde/imple?token=sometoken&amp;app=imp&amp;imple=IMP_Ajax_Imple_ContactAutoCompleter&amp;input=to&amp;to=Angl&quot; (obviously, I typed in &quot;Angl&quot;), and a  return with 820 addresses.... much more that the 50 that are given as default for 
&gt; &quot;&quot;...
&gt;
&gt; This seems to be a server-side thing.

You are going to need to trace the code in Turba (specifically the Turba_Api#search() method) to determine why it is returning all entries.  (Or Horde_Core_Ajax_Imple_ContactAutoCompleter, since that&#039;s where the search call is actually made).</description> 
   <pubDate>Sat, 03 May 2014 04:00:48 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/13152#t83512</link> 
  </item> 
   
  <item> 
   <title>&gt;&gt;&gt; Can&#039;t reproduce.  Sounds more like a Turba issue anyway.</title> 
   <description>&gt;&gt;&gt; Can&#039;t reproduce.  Sounds more like a Turba issue anyway.
&gt;&gt;
&gt;&gt; how should I proceed?
&gt;&gt;
&gt;&gt; a  - can you move this ticket to Turba or do I need to re-open
&gt;&gt; another ticket?
&gt;
&gt; Once its verified as an issue in Turba, I can move it.
&gt; [...]
&gt; You are going to need to trace the code in Turba (specifically the 
&gt; Turba_Api#search() method) to determine why it is returning all 
&gt; entries.  (Or Horde_Core_Ajax_Imple_ContactAutoCompleter, since 
&gt; that&#039;s where the search call is actually made).

to make a long story short: The effect was caused by a &quot;search_fields&quot; hook for IMP (I included that from the original Kolab client - that&#039;s why it slipped by). I don&#039;t understand why this happens, though.

In my IMP prefs.d/10-Kolab.php file I had  set &quot;$_prefs[&#039;search_fields&#039;][&#039;hook&#039;] = true;&quot; and hooks.php read

--- cut here ---
    public function prefs_init($pref, $value, $username, $scope_ob)
    {
        switch ($pref) {
        case &#039;add_source&#039;:
            // Dynamically set the add_source preference.
            return is_null($username)
                ? $value
                : $GLOBALS[&#039;registry&#039;]-&gt;call(&#039;contacts/getDefaultShare&#039;);


        case &#039;search_fields&#039;:
        case &#039;search_sources&#039;:
            // Dynamically set the search_fields/search_sources preferences.
            if (!is_null($username)) {
                $sources = $GLOBALS[&#039;registry&#039;]-&gt;call(&#039;contacts/sources&#039;);

                if ($pref == &#039;search_fields&#039;) {
                    $out = array();
                    foreach (array_keys($sources) as $source) {
                        $out[$source] = array_keys($GLOBALS[&#039;registry&#039;]-&gt;call(&#039;contacts/fields&#039;, array($source)));
                    }
                } else {
                    $out = array_keys($sources);
                }

                return json_encode($out);
            }

            return $value;
        }
    }
--- cut here ---
This probably is some &quot;old-style stuff&quot; - hooks aren&#039;t my cup of tea (yet), I included them from the original kolab-webmail package. During my initial debugging of this issue, I went through the following steps:

I&#039;ve added according debug statements and see that  $hordedir/imp/lib/Contacts.php:getAddressbookSearchParams() does return a huge set of search fields after a fresh login, but no search fields at all once I opened and saved IMP&#039;s &quot;user prefs/webmail/address books&quot; (WITHOUT CHANGING ANY PREF!)

I have attached a debug trace of the following code there:

--- cut here ---
    public function getAddressbookSearchParams()
    {
        global $prefs;

        $fields = json_decode($prefs-&gt;getValue(&#039;search_fields&#039;), true);

/* JUM DEBUG */
        Horde::debug( $fields);

        $src = json_decode($prefs-&gt;getValue(&#039;search_sources&#039;));

        return array(
            &#039;fields&#039; =&gt; empty($fields) ? array() : $fields,
            &#039;sources&#039; =&gt; empty($src) ? array() : $src
        );
    }
--- cut here ---

The first backtrace is generated before the settings were saved, the second backtrace (-&gt; empty $fields) after saving the IMP/webmail address book preferences (without modifying any setting!).

Looking at the user&#039;s preference page (Webmail/address books), when I loop through the address books that are in the list of ABs to be searched, it&#039;s always &quot;name&quot; and &quot;email addresses&quot; that&#039;s set as search fields for user address books, it&#039;s &quot;email addresses&quot; for &quot;most commonly used receivers&quot; and it&#039;s the full set of fields for &quot;global address book&quot;.

I&#039;ve tried to reduce the list of searched fields for the global address book - this setting is not stored across logins. (I selected &quot;name, surname, emails&quot;, saved the settings and verified they were the same, then logged off/on and again all fields were selected). This points to the user preference handling... at this point, I made the link to probably set hooks and looked it up. Once I disabled the &quot;search_fields&quot; hook, everything was working correctly.

Maybe you might want to move this ticket to the Kolab queue?

Regards,
Jens

PS: Something else that does catch the eye are hundreds of messages

--- cut here ---
2014-05-04T14:22:53+02:00 WARN: HORDE [turba] PHP ERROR: stripos() expects parameter 1 to be string, array given [pid 5743 on line 536 of &quot;/srv/www/htdocs.www.nde.ag.ssl/horde/turba/lib/Driver/Kolab.php&quot;]
--- cut here ---
in Horde&#039;s log file. These messages are created while the search Ajax call is executed, but only for those calles before the settings were saved. I&#039;ve created a separate ticket (http://bugs.horde.org/ticket/13161) and do not thing this issue is related, because if I disable searching array fields (I our case, seems it&#039;s only the field &quot;categories&quot;) temporarily, the result lists are still the same.</description> 
   <pubDate>Sun, 04 May 2014 13:35:13 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/13152#t83523</link> 
  </item> 
   
  <item> 
   <title>That&#039;s not an accurate/up-to-date search_fields configuratio</title> 
   <description>That&#039;s not an accurate/up-to-date search_fields configuration for the prefs_init hook.</description> 
   <pubDate>Tue, 13 May 2014 06:32:23 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/13152#t83631</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
