php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44860 session_encode() fails for php_binary serializer
Submitted: 2008-04-29 09:05 UTC Modified: 2010-06-21 00:31 UTC
From: ant@php.net Assigned:
Status: Wont fix Package: Session related
PHP Version: 6CVS-2008-04-29 (snap) OS: *
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: ant@php.net
New email:
PHP Version: OS:

 

 [2008-04-29 09:05 UTC] ant@php.net
Description:
------------
I've added a new test into the 6.0 branch called session_encode_variation7.phpt - the expected output for this test shows the problem. It shows that when unicode is enabled the output from session_encode when using the php_binary serialiser is wrong.

Reproduce code:
---------------
--TEST--
Test session_encode() function : variation
--SKIPIF--
<?php include('skipif.inc'); ?>
--INI--
session.serialize_handler=php_binary
--FILE--
<?php

ob_start();

/* 
 * Prototype : string session_encode(void)
 * Description : Encodes the current session data as a string
 * Source code : ext/session/session.c 
 */

echo "*** Testing session_encode() : variation ***\n";

var_dump(session_start());
$_SESSION["foo"] = 1234567890;
$encoded = session_encode();
var_dump(base64_encode($encoded));
var_dump(session_destroy());

echo "Done";
ob_end_flush();
?>
--EXPECTF--
*** Testing session_encode() : variation ***
bool(true)
string(24) "A2Zvb2k6MTIzNDU2Nzg5MDs="
bool(true)
Done
--UEXPECTF--
*** Testing session_encode() : variation ***
bool(true)
string(0) ""
bool(true)
Done



Expected result:
----------------
--UEXPECTF--
*** Testing session_encode() : variation ***
bool(true)
unicode(24) "A2Zvb2k6MTIzNDU2Nzg5MDs="
bool(true)
Done


Actual result:
--------------
--UEXPECTF--
*** Testing session_encode() : variation ***
bool(true)
string(0) ""
bool(true)
Done

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-30 00:12 UTC] felipe@php.net
string(0) "" ? I get another result...

*** Testing session_encode() : variation ***
bool(true)

Warning: base64_encode() expects parameter 1 to be strictly a binary string, Unicode string given in ... on line 18
NULL
bool(true)

 [2010-06-21 00:31 UTC] felipe@php.net
-Status: Open +Status: Wont fix
 [2010-06-21 00:31 UTC] felipe@php.net
Old trunk related.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 15:01:30 2024 UTC