1--TEST--
2Test session_create_id() function : basic functionality
3--INI--
4session.save_handler=files
5session.sid_length=32
6--SKIPIF--
7<?php include('skipif.inc'); ?>
8--FILE--
9<?php
10
11ob_start();
12
13/*
14 * Prototype : string session_create_id([string $prefix])
15 * Description : Create new session ID with prefix optionally.
16 * Source code : ext/session/session.c
17 */
18
19echo "*** Testing session_create_id() : basic functionality ***\n";
20
21// No session
22var_dump(session_create_id());
23var_dump(session_create_id('ABCD'));
24
25ini_set('session.use_strict_mode', true);
26$sid = session_create_id('XYZ');
27var_dump($sid);
28var_dump(session_id($sid));
29session_start();
30var_dump(session_id());
31var_dump(session_id() === $sid);
32session_destroy();
33
34ini_set('session.use_strict_mode', false);
35$sid = session_create_id('XYZ');
36var_dump($sid);
37var_dump(session_id($sid));
38session_start();
39var_dump(session_id());
40var_dump(session_id() === $sid);
41session_destroy();
42
43echo "Done";
44ob_end_flush();
45?>
46--EXPECTF--
47*** Testing session_create_id() : basic functionality ***
48string(32) "%s"
49string(36) "ABCD%s"
50string(35) "XYZ%s"
51string(0) ""
52string(32) "%s"
53bool(false)
54string(35) "XYZ%s"
55string(0) ""
56string(35) "XYZ%s"
57bool(true)
58Done
59