[Tickets #14522] Invalid UTF-8 session data gets passed to json_encode()

noreply at bugs.horde.org noreply at bugs.horde.org
Thu Nov 24 18:17:47 UTC 2016


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: https://bugs.horde.org/ticket/14522
------------------------------------------------------------------------------
  Ticket             | 14522
  Created By         | horde.wayne at ptaff.ca
  Summary            | Invalid UTF-8 session data gets passed to json_encode()
  Queue              | Horde Framework Packages
  Type               | Bug
  State              | Unconfirmed
  Priority           | 1. Low
  Milestone          |
  Patch              |
  Owners             |
------------------------------------------------------------------------------


horde.wayne at ptaff.ca (2016-11-24 18:17) wrote:

Have had these PHP errors in syslog for ages on my horde-5.2.16  
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.






More information about the bugs mailing list