|  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:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
17 + 13 = ?
Subscribe to this entry?

 [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-2022 The PHP Group
All rights reserved.
Last updated: Mon Oct 03 04:05:53 2022 UTC