xref: /PHP-5.3/ext/session/tests/008-php4.2.3.phpt (revision ae2e75a6)
1--TEST--
2bug compatibility: global is used albeit register_globals=0
3--SKIPIF--
4<?php include('skipif.inc');
5 if (version_compare(PHP_VERSION,"4.2.3-dev", "<")) die("skip this is for PHP >= 4.2.3");
6?>
7--INI--
8register_long_arrays=1
9session.use_cookies=0
10session.cache_limiter=
11register_globals=0
12session.bug_compat_42=1
13session.bug_compat_warn=1
14track_errors=1
15log_errors=0
16html_errors=0
17display_errors=1
18session.serialize_handler=php
19session.save_handler=files
20precision=14
21--FILE--
22<?php
23session_id("abtest");
24
25### Phase 1 cleanup
26session_start();
27session_destroy();
28
29### Phase 2 $HTTP_SESSION_VARS["c"] does not contain any value
30session_id("abtest");
31session_register("c");
32var_dump($c);
33unset($c);
34$c = 3.14;
35@session_write_close(); // this generates an E_WARNING which will be printed
36// by $php_errormsg so we can use "@" here. ANY further message IS an error.
37echo $php_errormsg."\n";
38unset($HTTP_SESSION_VARS);
39unset($c);
40
41### Phase 3 $HTTP_SESSION_VARS["c"] is set
42session_start();
43var_dump($HTTP_SESSION_VARS);
44unset($c);
45$c = 2.78;
46
47session_write_close();
48unset($HTTP_SESSION_VARS);
49unset($c);
50
51### Phase 4 final
52
53session_start();
54var_dump($c);
55var_dump($HTTP_SESSION_VARS);
56
57session_destroy();
58?>
59--EXPECTF--
60Deprecated: Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
61
62Deprecated: Function session_register() is deprecated in %s on line %d
63
64Notice: Undefined variable: c in %s on line %d
65NULL
66session_write_close(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively
67array(1) {
68  ["c"]=>
69  float(3.14)
70}
71
72Notice: Undefined variable: c in %s on line %d
73NULL
74array(1) {
75  ["c"]=>
76  float(3.14)
77}
78
79