xref: /PHP-8.0/ext/session/session.stub.php (revision 6fb08f46)
1<?php
2
3/** @generate-function-entries */
4
5function session_name(?string $name = null): string|false {}
6
7function session_module_name(?string $module = null): string|false {}
8
9function session_save_path(?string $path = null): string|false {}
10
11function session_id(?string $id = null): string|false {}
12
13function session_create_id(string $prefix = ""): string|false {}
14
15function session_regenerate_id(bool $delete_old_session = false): bool {}
16
17function session_decode(string $data): bool {}
18
19function session_encode(): string|false {}
20
21function session_destroy(): bool {}
22
23function session_unset(): bool {}
24
25function session_gc(): int|false {}
26
27function session_get_cookie_params(): array {}
28
29function session_write_close(): bool {}
30
31function session_abort(): bool {}
32
33function session_reset(): bool {}
34
35function session_status(): int {}
36
37function session_register_shutdown(): void {}
38
39/** @alias session_write_close */
40function session_commit(): bool {}
41
42/**
43 * @param callable|object $open
44 * @param callable|bool $close
45 */
46function session_set_save_handler(
47    $open,
48    $close = UNKNOWN,
49    callable $read = UNKNOWN,
50    callable $write = UNKNOWN,
51    callable $destroy = UNKNOWN,
52    callable $gc = UNKNOWN,
53    callable $create_sid = UNKNOWN,
54    callable $validate_sid = UNKNOWN,
55    callable $update_timestamp = UNKNOWN
56): bool {}
57
58function session_cache_limiter(?string $value = null): string|false {}
59
60function session_cache_expire(?int $value = null): int|false {}
61
62function session_set_cookie_params(array|int $lifetime_or_options, ?string $path = null, ?string $domain = null, ?bool $secure = null, ?bool $httponly = null): bool {}
63
64function session_start(array $options = []): bool {}
65
66interface SessionHandlerInterface
67{
68    /** @return bool */
69    public function open(string $path, string $name);
70
71    /** @return bool */
72    public function close();
73
74    /** @return string|false */
75    public function read(string $id);
76
77    /** @return bool */
78    public function write(string $id, string $data);
79
80    /** @return bool */
81    public function destroy(string $id);
82
83    /** @return int|false */
84    public function gc(int $max_lifetime);
85}
86
87interface SessionIdInterface
88{
89    /** @return string */
90    public function create_sid();
91}
92
93interface SessionUpdateTimestampHandlerInterface
94{
95    /** @return bool */
96    public function validateId(string $id);
97
98    /** @return bool */
99    public function updateTimestamp(string $id, string $data);
100}
101
102class SessionHandler implements SessionHandlerInterface, SessionIdInterface
103{
104    /** @return bool */
105    public function open(string $path, string $name) {}
106
107    /** @return bool */
108    public function close() {}
109
110    /** @return string|false */
111    public function read(string $id) {}
112
113    /** @return bool */
114    public function write(string $id, string $data) {}
115
116    /** @return bool */
117    public function destroy(string $id) {}
118
119    /** @return int|false */
120    public function gc(int $max_lifetime) {}
121
122    /** @return string */
123    public function create_sid() {}
124}
125