Bug #80192 [Com]: session.use_trans_sid brokes JSON encoded HTML string

From: Date: Sat, 17 Jul 2021 13:16:42 +0000
Subject: Bug #80192 [Com]: session.use_trans_sid brokes JSON encoded HTML string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235106@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80192&edit=1

 ID:                 80192
 Comment by:         php dot cd17c4 at inboxeen dot com
 Reported by:        thebetsuno at gmail dot com
 Summary:            session.use_trans_sid brokes JSON encoded HTML
                     string
 Status:             Verified
 Type:               Bug
 Package:            Output Control
 Operating System:   Any
 PHP Version:        7.3
 Block user comment: N
 Private report:     N

 New Comment:

https://concreterockville.com


Check us out!


Previous Comments:
------------------------------------------------------------------------
[2020-10-07 08:21:45] cmb@php.net

Confirmed: <https://3v4l.org/aRVKl>.

------------------------------------------------------------------------
[2020-10-07 04:21:39] thebetsuno at gmail dot com

Description:
------------
Enabled config parameter "session.use_trans_sid" breaks a JSON encoded HTML string.
Bug is reproducible in versions 5.6.40, 7.2.33 and I believe in other versions.

Test script:
---------------
<?php
ini_set("session.use_cookies", 0);
ini_set("session.use_only_cookies", 0);
ini_set("session.use_trans_sid", 1);
header('Content-Type: application/json');
echo json_encode('<a href="/test">test</a>');

Expected result:
----------------
"<a href=\"\/test?PHPSESSID=7siuuuk98ns2lps0v1v251f1k3\">test<\/a>"

Actual result:
--------------
"<a href=\?PHPSESSID=7siuuuk98ns2lps0v1v251f1k3"\/test\">test<\/a>"


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80192&edit=1


Thread (6 messages)

« previous php.bugs (#235106) next »