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