|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80192 session.use_trans_sid brokes JSON encoded HTML string
Submitted: 2020-10-07 04:21 UTC Modified: 2020-10-07 08:21 UTC
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:2 (100.0%)
From: thebetsuno at gmail dot com Assigned:
Status: Verified Package: Output Control
PHP Version: 7.3 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: thebetsuno at gmail dot com
New email:
PHP Version: OS:


 [2020-10-07 04:21 UTC] thebetsuno at gmail dot com
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:
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>"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-07 08:21 UTC]
-Status: Open +Status: Verified -Package: Session related +Package: Output Control -PHP Version: 7.2.34 +PHP Version: 7.3
 [2020-10-07 08:21 UTC]
Confirmed: <>.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Mar 31 10:04:43 2023 UTC