6.0.0-git
2019-07-15

[#14585] horde/nag/lib/Nag.php : 1733 [getSyncLists()]: Wron serialized array in prefs triggers warning
Summary horde/nag/lib/Nag.php : 1733 [getSyncLists()]: Wron serialized array in prefs triggers warning
Queue Nag
Queue Version Git master
Type Bug
State Resolved
Priority 1. Low
Owners mrubinsk (at) horde (dot) org
Requester torben (at) dannhauer (dot) info
Created 2017-02-21 (874 days ago)
Due
Updated 2017-10-20 (633 days ago)
Assigned 2017-02-27 (868 days ago)
Resolved 2017-03-01 (866 days ago)
Milestone
Patch Yes

History
2017-10-20 20:34:53 Git Commit Comment #21 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit cc51f97fc58140ffd7a7f0b696ec95c3875dea39
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Wed, 01 Mar 2017 15:19:53 -0500

Bug: 14585 Fix saving sync prefs when no default resource exists.

  M config/prefs.php

https://github.com/horde/turba/commit/cc51f97fc58140ffd7a7f0b696ec95c3875dea39
2017-10-20 20:34:41 Git Commit Comment #20 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit 48a9ecb0fecaed0f3be11c5157cb7d7d3feb7c27
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Wed, 01 Mar 2017 15:19:53 -0500

Bug: 14585 Fix saving sync prefs when no default resource exists.

  M config/prefs.php

https://github.com/horde/kronolith/commit/48a9ecb0fecaed0f3be11c5157cb7d7d3feb7c27
2017-10-20 20:34:09 Git Commit Comment #19 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit bf909a78d0da39dcc3859479bc92f7b8756713f6
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Wed, 01 Mar 2017 15:19:53 -0500

Bug: 14585 Fix saving sync prefs when no default resource exists.

  M config/prefs.php

https://github.com/horde/mnemo/commit/bf909a78d0da39dcc3859479bc92f7b8756713f6
2017-10-20 20:33:59 Git Commit Comment #18 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit 11a04dceb73e12aeca15f959ae4786ee67bf3128
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Wed, 01 Mar 2017 15:19:53 -0500

Bug: 14585 Fix saving sync prefs when no default resource exists.

  M config/prefs.php

https://github.com/horde/nag/commit/11a04dceb73e12aeca15f959ae4786ee67bf3128
2017-10-20 20:33:58 Git Commit Comment #17 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit e812f6fb6b0f128e6e32d1897ac1c340c19f912f
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Fri, 24 Feb 2017 12:40:22 -0500

[mjr] Avoid PHP warnings due to corrupt preference values (Bug #14585).

  M docs/CHANGES
  M lib/Nag.php
  M package.xml

https://github.com/horde/nag/commit/e812f6fb6b0f128e6e32d1897ac1c340c19f912f
2017-03-01 20:49:40 torben (at) dannhauer (dot) info Comment #16 Reply to this comment

[Show Quoted Text - 15 lines]
Great, works on my side!

Thanks for your service, outstanding as always :)

Torben
2017-03-01 20:22:25 Michael Rubinsky State ⇒ Resolved
 
2017-03-01 20:22:16 Git Commit Comment #15 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit 1b4cf11b0d53d62c5202d3f85f7cb2555e8fff33
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Wed Mar 1 15:13:54 2017 -0500

     Bug: 14585 Fix saving sync prefs when no default resource exists.

  kronolith/config/prefs.php | 8 ++++++--
  mnemo/config/prefs.php     | 8 ++++++--
  nag/config/prefs.php       | 8 ++++++--
  turba/config/prefs.php     | 6 +++++-
  4 files changed, 23 insertions(+), 7 deletions(-)

http://github.com/horde/horde/commit/1b4cf11b0d53d62c5202d3f85f7cb2555e8fff33
2017-03-01 20:14:56 Git Commit Comment #14 Reply to this comment
Changes have been made in Git (master):

commit 97a6ba40fa7659dc71d61a432ea16dacc8a12e51
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Wed Mar 1 15:13:54 2017 -0500

     Bug: 14585 Fix saving sync prefs when no default resource exists.

  kronolith/config/prefs.php | 8 ++++++--
  mnemo/config/prefs.php     | 8 ++++++--
  nag/config/prefs.php       | 8 ++++++--
  turba/config/prefs.php     | 6 +++++-
  4 files changed, 23 insertions(+), 7 deletions(-)

http://github.com/horde/horde/commit/97a6ba40fa7659dc71d61a432ea16dacc8a12e51
2017-02-27 15:54:09 Michael Rubinsky Comment #13
State ⇒ Assigned
Reply to this comment

[Show Quoted Text - 11 lines]
Shoot. Sorry about that. I totally forgot about that config option :)

[Show Quoted Text - 22 lines]
Correct. I want to prevent the faulty data from being created in the 
first place.

2017-02-27 13:02:41 torben (at) dannhauer (dot) info Comment #12 Reply to this comment
Do I need to configure something in horde to create default tasklists?
Nope. This is done automatically when the user logs in. See 
Nag::initialize(), which calls 
Nag_Tasklists_Base::ensureDefaultShare().
Ah, in my case, auto-create was not enabled, it has to be enabled in 
the horde administration interface. Now the default shares are created 
as you describe. Thanks!

Back to the topic of this ticket:

Can you verify my bugreport by the following steps?
1. In the horde configuration, set $conf['share']['auto_create'] = false;
2. delete _all_ tasklists including the default one
3. To to Nag user preferences -> synchronisation settings -> check 
"support separate tasklists" and save the pref.
4. Go Into the SQL Database and query: Select * FROM horde_prefs WHERE 
pref_value = 'a:1:{i:0;N;}';


I think, that horde should be able to handle non-existent shares in an 
app correctly, since Hordes "auto-create" feature is an option and not 
mandatory.
Therfore a fix should be applied not only to nag and mnemo (already 
done) but also to kronolith and turba.

Now we know what causes the issue, we can either fix it as you did on 
the evaluation side of this horde pref ( getSyncXYZ() ), or we fix it 
at the creation side in the sync preferences where this value is 
stored into the preferences. The latter whould by better regarding 
performance...

What do you think?



2017-02-26 18:41:51 Michael Rubinsky Comment #11 Reply to this comment
Do I need to configure something in horde to create default tasklists?
Nope. This is done automatically when the user logs in. See 
Nag::initialize(), which calls Nag_Tasklists_Base::ensureDefaultShare().

2017-02-25 21:04:57 torben (at) dannhauer (dot) info Comment #10 Reply to this comment

[Show Quoted Text - 9 lines]
Here our scenarios differs the first time: In my setup, there is no 
default tasklist.
I think we should investigate why your setup provides a default 
tasklist where mine does not.

Do I need to configure something in horde to create default tasklists?
Where is it created? When the user logs in the first time, or when the 
user is added to horde in the admin interface?

In our setup we use $conf['auth']['driver'] = 'sql'; and point to a 
different SQL table outside the horde DB. Additionally users are not 
added in Horde but from a 3rdParty interface into that auth 
database/table. This interface does more than adding the user, so I 
don't want to abandon it until I have moved everything into a horde 
module.



  - I see a "Michael's Tasklist" already choosen. Without
saving, I navigate to Synchronization preferences - the list of 
other tasklists is empty, as it should be since there are no 
tasklists other than the default - I check "support separate 
tasklists" and save the pref. I check the preference value in the 
backend, and it appears as it should:

a:1:{i:0;s:23:"xEkS5vys4L4MXV03oZZAiQ4";}
2017-02-25 17:23:56 Michael Rubinsky State ⇒ Feedback
 
2017-02-25 17:22:36 Michael Rubinsky Comment #9 Reply to this comment
My experience for years is different: for every user I had to define 
their default calender|tasklist|notepad. Login into a pristine 
account had non of them defined.
I can't reproduce this. I started with a completely fresh database, 
logged in with a user for the first time. I navigate to the 
application's (in this case, nag) preferences and view "Default 
Tasklist" - I see a "Michael's Tasklist" already choosen. Without 
saving, I navigate to Synchronization preferences - the list of other 
tasklists is empty, as it should be since there are no tasklists other 
than the default - I check "support separate tasklists" and save the 
pref. I check the preference value in the backend, and it appears as 
it should:

a:1:{i:0;s:23:"xEkS5vys4L4MXV03oZZAiQ4";}
2017-02-24 20:52:09 torben (at) dannhauer (dot) info Comment #8 Reply to this comment
We're *supposed* to always have at least one tasklist defined, so 
I'll have to look into this.

Thanks for the research.
My experience for years is different: for every user I had to define 
their default calender|tasklist|notepad. Login into a pristine account 
had non of them defined.
2017-02-24 20:41:56 Michael Rubinsky Comment #7
State ⇒ Assigned
Reply to this comment
We're *supposed* to always have at least one tasklist defined, so I'll 
have to look into this.

Thanks for the research.
2017-02-24 19:32:55 torben (at) dannhauer (dot) info Comment #6 Reply to this comment
Really would like to find the cause of these corrupt pref entries, 
but this prevents the warnings.
Hah, I'm able to reproduce it! :)

The reason is simple:

If you go into the sync settings and enable "separate 
notepad|tasks|whatever" without having a single list|notepad|whatever 
defined, it creates the faulty 'a:1:{i:0;N;}' entry.
  The entry does not disappear if disableing separate   
list|notepad|whatever, the the issue seems to be saving the sync pref 
page whithout any defined  list|notepad|whatever.

2017-02-24 19:23:32 torben (at) dannhauer (dot) info Comment #5 Reply to this comment
Really would like to find the cause of these corrupt pref entries, 
but this prevents the warnings.
Yesm thought about that..

I had the issue with one of 35 Account - and only nag and Mnemo.
Opening the sync settings (in both, nag and Mnemo) and simply pressing 
"save" fixed the faulty entry in the database. Is it possible this is 
caused if someone configures multiple collections, configure them as 
"sync them additionally to the default one) and then delete them?
-> I tried this and I was proven wrong :) However, I can see, that 
deleting an conllection dopes not clean up the pref value.
Example:
I added in Mnemo two collections, configured them both as "to be 
synced". The Database contains them both in the pref "sync_notepads".
Deleting one of them does not remove it from the sync_notepads pref value.

I assume that is also valid for nag, turba, kronolith..

Torben
2017-02-24 17:45:46 Michael Rubinsky Comment #4
Assigned to Michael Rubinsky
State ⇒ Resolved
Reply to this comment
Really would like to find the cause of these corrupt pref entries, but 
this prevents the warnings.
2017-02-24 17:45:12 Git Commit Comment #3 Reply to this comment
Changes have been made in Git (master):

commit da87bbd4b4be301c2633ee75290d4f1f0d17b61e
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Fri Feb 24 12:40:22 2017 -0500

     [mjr] Avoid PHP warnings due to corrupt preference values (Bug #14585).

  nag/docs/CHANGES | 5 +++++
  nag/lib/Nag.php  | 4 ++++
  nag/package.xml  | 2 +-
  3 files changed, 10 insertions(+), 1 deletion(-)

http://github.com/horde/horde/commit/da87bbd4b4be301c2633ee75290d4f1f0d17b61e
2017-02-24 17:40:38 Git Commit Comment #2 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit 1dde87a714bab1751b6f8e566f898007439eb1ae
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Fri Feb 24 12:40:22 2017 -0500

     [mjr] Avoid PHP warnings due to corrupt preference values (Bug #14585).

  nag/docs/CHANGES | 1 +
  nag/lib/Nag.php  | 4 ++++
  nag/package.xml  | 4 ++--
  3 files changed, 7 insertions(+), 2 deletions(-)

http://github.com/horde/horde/commit/1dde87a714bab1751b6f8e566f898007439eb1ae
2017-02-21 22:44:44 torben (at) dannhauer (dot) info Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Summary ⇒ horde/nag/lib/Nag.php : 1733 [getSyncLists()]: Wron serialized array in prefs triggers warning
Queue ⇒ Nag
Milestone ⇒
Patch ⇒ Yes
Reply to this comment
When an array with NULL Value is stored in the Horde prefs, Nag thows 
an PHP warning: 'array_flip(): Can only flip STRING and INTEGER values!'

This is caused by an erroneous Horde Pref like 'a:1:{i:0;N;}'. 
Deserialized, this array contains a Null Value and is this not 
flippable.

When loaded from the DB and deserialized, the array should be validated with
$cs = array_filter($cs); before it is used.

This is similar to 
https://github.com/horde/horde/commit/3fdf04396ec905d53e762cfbac92f070f2487fda 
for Mnemo


Saved Queries