6.0.0-beta1
7/7/25

[#9431] pref hook : Infinite Loop
Summary pref hook : Infinite Loop
Queue IMP
Queue Version Git master
Type Bug
State Resolved
Priority 1. Low
Owners slusarz (at) horde (dot) org
Requester rsalmon (at) mbpgroup (dot) com
Created 12/06/2010 (5327 days ago)
Due
Updated 12/09/2010 (5324 days ago)
Assigned 12/07/2010 (5326 days ago)
Resolved 12/08/2010 (5325 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
12/08/2010 09:44:25 AM rsalmon (at) mbpgroup (dot) com Comment #5 Reply to this comment
this doesn't work for me.

framework/Core/lib/Horde/Registry.php:1357
php seams to be running code up to $prefs->retrieve($app), but never returns.

here is the output of print_r($prefs) just before calling 
$prefs->retrieve($app) (login, wait 2 seconds and kill httpd) :
HORDE [imp] Horde_Prefs Object
(
     [_cache:protected] => Horde_Core_Prefs_Cache_Session Object
         (
             [_params:protected] => Array
                 (
                     [user] => rsalmon
                 )
         )
...
     [_storage:protected] => Array
         (
             [0] => Horde_Core_Prefs_Storage_Configuration Object
                 (
                     [hooks] => Array
                         (
                             [imp] => Array
                                 (
                                     [0] => search_sources
                                     ...
                                     [140] => search_sources
                                 )
                         )
                     [_params:protected] => Array
                         (
                             [user] => rsalmon
                         )
                 )
             [1] => Horde_Prefs_Storage_Sql Object
             ...
             [2] => Horde_Core_Prefs_Storage_Hooks Object
                 (
                     [_params:protected] => Array
                         (
                             [conf_ob] => 
Horde_Core_Prefs_Storage_Configuration Object
                                 (
                                     [hooks] => Array
                                         (
                                             [imp] => Array
                                                 (
                                                     [0] => search_sources
                                                     ...
                                                     [140] => search_sources
                                                 )

                                         )

                                     [_params:protected] => Array
                                         (
                                             [user] => rsalmon
                                         )

                                 )

                             [user] => rsalmon
                         )




12/08/2010 12:08:48 AM Michael Slusarz Comment #4
Assigned to Michael Slusarz
State ⇒ Resolved
Reply to this comment
That hook does not work because it is causing the infinite loop.  You 
can't get the value of the preference with a getValue() call when the 
preference hasn't been set yet.  Duh, Michael.

That being said, there does need to be a way to indicate from the hook 
that the original preference value should be used.  I originally 
committed something to allow returning null to indicate the original 
value should be used.  But it makes more sense to pass the original 
value in, since it may be useful to alter the original value.
12/07/2010 08:03:24 AM rsalmon (at) mbpgroup (dot) com Comment #3
New Attachment: imp-hook.php Download
Reply to this comment
What is the contents of your prefs hook?
file attached

12/07/2010 12:21:54 AM Michael Slusarz Comment #2
State ⇒ Feedback
Reply to this comment
What is the contents of your prefs hook?
12/06/2010 03:41:26 PM rsalmon (at) mbpgroup (dot) com Comment #1
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ pref hook : Infinite Loop
Queue ⇒ IMP
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
Reply to this comment
with the following setting and hook.php configure using the provided exemple
$_prefs['search_sources'] = array(
     'value' => '',
        'locked' => true,
        'hook' => true
);

When I try to login I get (indefinitely) in /tmp/horde.log :

2010-12-06T17:20:54+01:00 DEBUG: HORDE [imp] Hook prefs_init in 
application imp called. [pid 28875 on line 1688 of 
"/var/www/html/horde/libs/Horde.php"]
2010-12-06T17:20:54+01:00 DEBUG: HORDE [turba] SQL  (0,0004s)
         SELECT COUNT(*) FROM horde_perms WHERE perm_name =
           'turba:sources:localldap' [pid 28875 on line 754 of 
"/var/www/html/horde/libs/Horde/Db/Adapter/Base.php"]
2010-12-06T17:20:54+01:00 DEBUG: HORDE [imp] SQL  (0,0007s)
         SELECT pref_scope, pref_name, pref_value FROM horde_prefs WHERE
           pref_uid = 'rsalmon' AND pref_scope = 'imp' [pid 28875 on 
line 754 of "/var/www/html/horde/libs/Horde/Db/Adapter/Base.php"]
2010-12-06T17:20:54+01:00 DEBUG: HORDE [imp] Hook prefs_init in 
application imp called. [pid 28875 on line 1688 of 
"/var/www/html/horde/libs/Horde.php"]
2010-12-06T17:20:54+01:00 DEBUG: HORDE [turba] SQL  (0,0004s)
         SELECT COUNT(*) FROM horde_perms WHERE perm_name =
           'turba:sources:localldap' [pid 28875 on line 754 of 
"/var/www/html/horde/libs/Horde/Db/Adapter/Base.php"]
2010-12-06T17:20:54+01:00 DEBUG: HORDE [imp] SQL  (0,0008s)
...


From what I could track down :
Registry.php, function popApp(), php seams to be running code up to 
line 1241 :
  $this->_onAppSwitch($app).






Nothing to do with this ticket, but there is a typo in 
framework/Ldap/lib/Horde/Ldap/Entry.php
--- Entry.php.old        2010-12-06 17:30:46.000000000 +0100
+++ Entry.php        2010-12-06 17:30:51.000000000 +0100
@@ -289 +289 @@
-            for ($attr = @ldap_first_attribute($this->_link, 
$this->_entry, $ber);
+            for ($attr = @ldap_first_attribute($this->_link, $this->_entry);
@@ -291 +291 @@
-                 $attr = @ldap_next_attribute($this->_link, 
$this->_entry, $ber)) {
+                 $attr = @ldap_next_attribute($this->_link, $this->_entry)) {

Saved Queries