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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 10:01:26 2024 UTC