Summary | Invalid UTF-8 session data gets passed to json_encode() |
Queue | Horde Framework Packages |
Type | Bug |
State | Resolved |
Priority | 1. Low |
Owners | jan (at) horde (dot) org |
Requester | horde.wayne (at) ptaff (dot) ca |
Created | 11/24/2016 (3248 days ago) |
Due | |
Updated | 11/25/2016 (3247 days ago) |
Assigned | |
Resolved | 11/25/2016 (3247 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
Assigned to Jan Schneider
State ⇒ Resolved
commit f3c5faddd3663d6cf78f4c74ef6c2c96d89a8a4b
Author: Jan Schneider <jan@horde.org>
Date: Fri Nov 25 10:06:13 2016 +0100
Avoid notice if packing an invalid UTF-8 string.
Bug: 14522framework/Pack/lib/Horde/Pack/Driver/Json.php | 2 ++
framework/Pack/test/Horde/Pack/Driver/JsonTest.php | 9 +++++++++
2 files changed, 11 insertions(+)
http://github.com/horde/horde/commit/f3c5faddd3663d6cf78f4c74ef6c2c96d89a8a4b
framework/Core/lib/Horde/Session.php
Priority ⇒ 1. Low
Patch ⇒ No
Milestone ⇒
Queue ⇒ Horde Framework Packages
Summary ⇒ Invalid UTF-8 session data gets passed to json_encode()
Type ⇒ Bug
State ⇒ Unconfirmed
webmail installation (and previous versions):
PHP ERROR: json_encode(): Invalid UTF-8 sequence in argument [pid
30552 on line 48 of ".../pear/php/Horde/Pack/Driver/Json.php"]
I finally decided to dig into it and find if the cause is a local
problem or systematic. Confirmed, a 44-byte binary (non UTF-8) string
gets passed to json_encode().
I could get a backtrace:
'#0 /var/www/sites/horde5.ptaff.ca/pear/php/Horde/Pack.php(130):
Horde_Pack_Driver_Json->pack(Array)
#1/var/www/sites/horde5.ptaff.ca/pear/php/Horde/Session.php(430):Horde_Pack->pack(Array, Array)
#2/var/www/sites/horde5.ptaff.ca/pear/php/Horde/Registry.php(2458):Horde_Session->set(\'horde\', \'auth_app/gollem\', Array, 4)
#3/var/www/sites/horde5.ptaff.ca/pear/php/Horde/Registry.php(2581):Horde_Registry->setAuthCredential(Array, NULL, \'gollem\')
It thus seems like a regression happened with that commit:
https://github.com/horde/horde/commit/54a1644952151bea3dc942e0b334e07810e9e188
Where PHP's serialize() would be happy to be fed binary data, and
json_encode() is not.
Not sure about the right approach here to fix this as JSON's not
designed to handle raw binary data.