Bug #81025 [Com]: Session deserialization does not handle UTF-8 BOM

From: Date: Sun, 09 May 2021 22:14:51 +0000
Subject: Bug #81025 [Com]: Session deserialization does not handle UTF-8 BOM
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233759@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81025&edit=1 ID: 81025 Comment by: fgfgfg dot hjhjhjhj at ghghgh dot fg Reported by: Parkhideh at att dot net Summary: Session deserialization does not handle UTF-8 BOM Status: Open Type: Bug Package: Built-in web server Operating System: Windows 10 PHP Version: 7.4.19 Block user comment: N Private report: N New Comment: don't use BOM - well known fact for 15 years at least Previous Comments: ------------------------------------------------------------------------ [2021-05-09 22:11:59] Parkhideh at att dot net Description: ------------ --- From manual page: https://php.net/function.session-start --- I read many comments about why a session_start() does not connect. Luckily one of my 8 lines test program did work. The difference was the non-working php file was saved as "UTF-8 with BOM" that made every thing else work but session_start(). Note that on the local PortableApps xampp with php 8.0.3 under Windows 10 session_start() connects correctly. On host www.1and1.com with php 7.4 and 8.05 this problem shows. Frankly I did not know that UTF-8 had a BOM option till now!! Unicode https://www.unicode.org/faq/utf_bom.html claims it doesn't, Windows 10 does it anyway. Test script: --------------- Setup php file: <?php session_start(); $_SESSION['keyword'] = 1916; $_SESSION['driverVer'] = "1.1.1"; $CrLf = "\r\n"; echo "<br>PHP version is " . phpversion() . $CrLf; exit; ?> Run file showing the error: <?php session_start(); $q = $_SESSION['keyword']; $v = $_SESSION['driverVer']; $CrLf = "\r\n"; echo "<br>-- $q -- $v -- , PHP version is " . phpversion() . $CrLf; exit; ?> Expected result: ---------------- If the second file is saved as "UTF-8 with BOM"; then on some systems it will generate an error message. Note that the same file saved as UTF-8 is a few bytes smaller, but both will pass the compare text test. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81025&edit=1

« previous php.bugs (#233759) next »