php.net |  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
From: thebetsuno at gmail dot com Assigned:
Status: Verified Package: Output Control
PHP Version: 7.3 OS: Any
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2020-10-07 04:21 UTC] 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>"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-07 08:21 UTC] cmb@php.net
-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] cmb@php.net
Confirmed: <https://3v4l.org/aRVKl>.
 [2020-11-09 12:27 UTC] johnlilly055 at gmail dot com
Wow! Helpful and fascinating article. Thanks for sharing such a great article with us.  Keep sharing.https://www.thegenuineleather.com/category/cyber-monday-deals/
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Dec 03 14:01:27 2020 UTC