#44860 [Opn]: session_encode fails for php_binary serialiser

From: Date: Wed, 30 Apr 2008 00:12:09 +0000
Subject: #44860 [Opn]: session_encode fails for php_binary serialiser
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-124598@lists.php.net to get a copy of this message
ID: 44860 Updated by: felipe@php.net Reported By: ant@php.net Status: Open Bug Type: Session related Operating System: All PHP Version: 6CVS-2008-04-29 (snap) New Comment: 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) Previous Comments: ------------------------------------------------------------------------ [2008-04-29 09:05:46] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44860&edit=1

« previous php.bugs (#124598) next »