1--TEST--
2Test session_id() function : variation
3--SKIPIF--
4<?php include('skipif.inc'); ?>
5--INI--
6session.hash_function=0
7--FILE--
8<?php
9
10ob_start();
11
12/*
13 * Prototype : string session_id([string $id])
14 * Description : Get and/or set the current session id
15 * Source code : ext/session/session.c
16 */
17
18echo "*** Testing session_id() : variation ***\n";
19
20$directory = dirname(__FILE__);
21$filename = ($directory."/entropy.txt");
22var_dump(ini_set("session.entropy_file", $filename));
23var_dump(file_put_contents($filename, "Hello World!"));
24var_dump(ini_set("session.entropy_length", filesize($filename)));
25
26var_dump(ini_set("session.hash_function", 0));
27var_dump(session_id());
28var_dump(session_start());
29var_dump(session_id());
30var_dump(session_destroy());
31
32var_dump(ini_set("session.hash_function", 1));
33var_dump(session_id());
34var_dump(session_start());
35var_dump(session_id());
36var_dump(session_destroy());
37var_dump(unlink($filename));
38
39echo "Done";
40ob_end_flush();
41?>
42--EXPECTF--
43*** Testing session_id() : variation ***
44string(0) ""
45int(12)
46string(1) "0"
47string(1) "0"
48string(0) ""
49bool(true)
50string(%d) "%s"
51bool(true)
52string(1) "0"
53string(0) ""
54bool(true)
55string(%d) "%s"
56bool(true)
57bool(true)
58Done
59
60