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

From: Date: Wed, 07 Oct 2020 04:21:39 +0000
Subject: Bug #80192 [NEW]: session.use_trans_sid brokes JSON encoded HTML string
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229434@lists.php.net to get a copy of this message
From:             thebetsuno at gmail dot com
Operating system: Any
PHP version:      7.2.34
Package:          Session related
Bug Type:         Bug
Bug description:session.use_trans_sid brokes JSON encoded HTML string

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 bug report at https://bugs.php.net/bug.php?id=80192&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80192&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80192&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80192&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80192&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80192&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80192&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80192&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80192&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80192&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80192&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80192&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80192&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80192&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80192&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80192&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80192&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80192&r=mysqlcfg


Thread (6 messages)

« previous php.bugs (#229434) next »