Re: /usr/bin/kronolith-agenda Horde_Prefs_Scope::serialize() must return a string or NULL

Samuel Wolf <[email protected]>
Newsgroups gmane.comp.horde.kronolith
Message-ID <[email protected]>
Zitat von Michael Menge <[email protected]>:

> Quoting Samuel Wolf <[email protected]>:
>
>> Zitat von Samuel Wolf <[email protected]>:
>>
>>> Zitat von Michael J Rubinsky <[email protected]>:
>>>
>>>> Quoting Samuel Wolf <[email protected]>:
>>>>
>>>>> Zitat von Michael J Rubinsky <[email protected]>:
>>>>>
>>>>>> Quoting Samuel Wolf <[email protected]>:
>>>>>>
>>>>>>> Zitat von Michael J Rubinsky <[email protected]>:
>>>>>>>
>>>>>>>> Quoting Samuel Wolf <[email protected]>:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> does somebody has any idea whats wrong here?
>>>>>>>>>
>>>>>>>>> Samuel
>>>>>>>>>
>>>>>>>>> root@mailserver:~# php5 /usr/bin/kronolith-agenda
>>>>>>>>>
>>>>>>>>> ====================
>>>>>>>>>
>>>>>>>>> Fatal Error:
>>>>>>>>> Horde_Prefs_Scope::serialize() must return a string or NULL
>>>>>>>>> In /usr/share/php/Horde/Prefs/Cache/HordeCache.php on line 62
>>>>>>>>>
>>>>>>>>> 1. send_agendas() /usr/bin/kronolith-agenda:22
>>>>>>>>> 2. Horde_Prefs->getValue() /usr/bin/kronolith-agenda:100
>>>>>>>>> 3. Horde_Prefs->_getScope() /usr/share/php/Horde/Prefs.php:250
>>>>>>>>> 4. Horde_Prefs->_loadScope() /usr/share/php/Horde/Prefs.php:348
>>>>>>>>> 5. Horde_Prefs_Cache_HordeCache->store()  
>>>>>>>>> /usr/share/php/Horde/Prefs.php:418
>>>>>>>>> 6. serialize() /usr/share/php/Horde/Prefs/Cache/HordeCache.php:62
>>>>>>>>
>>>>>>>>
>>>>>>>> Looks like the serialization fails for some reason, and since  
>>>>>>>> json_encode() returns FALSE for this it throws a fatal error  
>>>>>>>> since the serialize interface must return a string or NULL.  
>>>>>>>> *WHY* it's failing, I'm not sure off hand - I'll have to look  
>>>>>>>> into it. At the very least, we need to catch the false value  
>>>>>>>> and change it to null.
>>>>>>>
>>>>>>> It is not a general problem, the script work on my home horde  
>>>>>>> server without a error.
>>>>>>> Idea to debug this?
>>>>>>>
>>>>>>> I am sure this script work in the past without the error, but  
>>>>>>> have no idea which change/update broke it...
>>>>>>
>>>>>> Basically, the only thing I know for sure is that json_decode()  
>>>>>> is returning false in that method. I would need to see the data  
>>>>>> that it is attempting to serialize to know *why* it is failing.  
>>>>>> My guess is that it's some non UTF-8 data (which as of PHP 5.5  
>>>>>> causes json_decode to fail whereas before this, it would only  
>>>>>> null out the offending string).
>>>>>>
>>>>>> If you want to spend time on this, you can insert something like:
>>>>>>
>>>>>> Horde::debug(array($this->scope, $this->_prefs));
>>>>>>
>>>>>> into Horde_Prefs_Scope::serialize() and see what the values are  
>>>>>> when this fails.
>>>>>
>>>>> I add the debug code in /usr/share/php/Horde/Pres/Scope.php
>>>>>
>>>>> public function serialize()
>>>>> {
>>>>>     Horde::debug(array($this->scope, $this->_prefs));
>>>>>     return json_encode(array(
>>>>>         $this->scope,
>>>>>         $this->_prefs
>>>>>     ));
>>>>> }
>>>>>
>>>>> This produce a long debug log file, but I can not see a problem  
>>>>> there. Something I can grep for?
>>>>
>>>> Was hoping there would be something obvious there in the data.  
>>>> So, you got the error, but the data looked normal-ish? Maybe try  
>>>> a Horde::debug(json_encode(array($this->scope, $this->_prefs)));  
>>>> just to be sure the json_encode is failing on the call that you  
>>>> are dumping...
>>>
>>> [...]
>>>
>>> Backtrace:
>>> 1. send_agendas() /usr/bin/kronolith-agenda:22
>>> 2. Horde_Prefs->getValue() /usr/bin/kronolith-agenda:85
>>> 3. Horde_Prefs->_getScope() /usr/share/php/Horde/Prefs.php:250
>>> 4. Horde_Prefs->_loadScope() /usr/share/php/Horde/Prefs.php:343
>>> 5. Horde_Prefs_Cache_HordeCache->store() /usr/share/php/Horde/Prefs.php:418
>>> 6. serialize() /usr/share/php/Horde/Prefs/Cache/HordeCache.php:62
>>> 7. Horde_Prefs_Scope->serialize()
>>> 8. Horde::debug() /usr/share/php/Horde/Prefs/Scope.php:311
>>>
>>> 2015-11-02T19:32:15+01:00 DEBUG: Variable information:
>>> bool(false)
>>>
>>> Backtrace:
>>> 1. send_agendas() /usr/bin/kronolith-agenda:22
>>> 2. Horde_Prefs->getValue() /usr/bin/kronolith-agenda:100
>>> 3. Horde_Prefs->_getScope() /usr/share/php/Horde/Prefs.php:250
>>> 4. Horde_Prefs->_loadScope() /usr/share/php/Horde/Prefs.php:348
>>> 5. Horde_Prefs_Cache_HordeCache->store() /usr/share/php/Horde/Prefs.php:418
>>> 6. serialize() /usr/share/php/Horde/Prefs/Cache/HordeCache.php:62
>>> 7. Horde_Prefs_Scope->serialize()
>>> 8. Horde::debug() /usr/share/php/Horde/Prefs/Scope.php:311
>>>
>>> -----------------------------------------------------------------------
>>>
>>> It Should be "Standardidentität", is this the problem?
>>>
>>> [...] a:13:{s:2:"id";s:17:"Standardidentit<E4>t";s:8:"fullname"; [...]
>>
>
> It seems your datas is encoded in ISO-8859-1 or an other ISO-8859 charsets.
> "ä" is charackter 228 = 0xE4 in ISO-8859-1. In UTF-8 0xE4 the begin  
> of a 3 byte character
> but not all byte esquences are valid.
>
> ä is a 2 byte character (0xC3A4) in UTF-8. If you convert the date  
> to UTF-8 you have to
> adjust the string length (the number behind the s:) to the correct  
> string length in bytes

Mhm the most tables are in utf8_general_ci, but horde_prefs is in  
latin1_swedish_ci.
No idea why.

>
>
>
>> This was the problem, the profile was from an old user which never  
>> login the past few years.
>> After delete his settings in horde_prefs, the problem gone.
>>
>
>
> --------------------------------------------------------------------------------
> M.Menge                                Tel.: (49) 7071/29-70316
> Universität Tübingen                   Fax.: (49) 7071/29-5912
> Zentrum für Datenverarbeitung          mail:  
> [email protected]
> Wächterstraße 76
> 72074 Tübingen
>
> -- 
> kronolith mailing list
> Frequently Asked Questions: http://wiki.horde.org/FAQ
> To unsubscribe, mail: [email protected]



-- 
kronolith mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.