php-src/ext/session/tests/session_encode_serialize.phpt
Yasuo Ohgaki c51f77fe83 Add php_serialize session.serialize_handler. This patch closes
Request #25630
  Request #43980
  Request #54383
  Bug #65359

and many others similar to these that are closed as "wont fix" or
"not a bug".

Current serializers have limitations due to register_globals support
that are no longer supported. Changing existing serializer may cause
compatibility issue. Therefore, new handler is needed to remove
needless limitations.

php_serialize does not have special characters and allow numerical
index in $_SESSION. $_SESSION can be used as ordinary array.
2013-08-21 10:51:51 +09:00

25 lines
500 B
PHP

--TEST--
Test session_encode() function : Numeric key raise error. bug65359
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php
ob_start();
ini_set('session.serialize_handler', 'php_serialize');
var_dump(session_start());
$_SESSION[-3] = 'foo';
$_SESSION[3] = 'bar';
$_SESSION['var'] = 123;
var_dump(session_encode());
session_write_close();
// Should finish without errors
echo 'Done'.PHP_EOL;
?>
--EXPECTF--
bool(true)
string(51) "a:3:{i:-3;s:3:"foo";i:3;s:3:"bar";s:3:"var";i:123;}"
Done