php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46784 Mixing page encodings (UTF8/ASCII) makes unrecognized session variables
Submitted: 2008-12-06 14:31 UTC Modified: 2008-12-07 22:11 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: simon dot uyttendaele at gmail dot com Assigned:
Status: Closed Package: Session related
PHP Version: 5.2.7 OS: Debian etch
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: simon dot uyttendaele at gmail dot com
New email:
PHP Version: OS:

 

 [2008-12-06 14:31 UTC] simon dot uyttendaele at gmail dot com
Description:
------------
 - Having an auto_prepend script encoded in UTF8
 - One regular page encoded in ASCII
 - A second page encoded in UTF8

(or the other way around)

Makes all the associative session variables unrecognized.

print_r($_SESSION) does out put the correct session variables. (the key is probably encoded differently which makes it not recognize it)



Reproduce code:
---------------
PREPEND FILE ENCODED IN UTF8 (no BOM) :

<?php
    $dummy = true;
?>

REGULAR FILE ENCODED IN ASCII :

<?php
    session_start();
    $_SESSION['foo'] = 42;

    include( <second page> );
?>

REGULAR FILE ENCODED IN UTF8 :

<?php
    echo $_SESSION['foo'];
    print_r($_SESSION);
?>


Expected result:
----------------
Display :
-----------------
42Array( [foo] => 42 )
-----------------

Actual result:
--------------
Display :
-----------------
Array( [foo] => 42 )
-----------------

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-07 22:11 UTC] simon dot uyttendaele at gmail dot com
Recompiling PHP made the problem disapear. It is no longer reproductible.

So hopefully, the problem is now solved.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 17:01:28 2025 UTC