-
Notifications
You must be signed in to change notification settings - Fork 8k
Expand file tree
/
Copy pathgh_gc_retval_leak.phpt
More file actions
33 lines (29 loc) · 964 Bytes
/
gh_gc_retval_leak.phpt
File metadata and controls
33 lines (29 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--TEST--
session_gc(): user handler returning non-bool/non-int does not leak memory
--INI--
session.gc_probability=0
session.save_handler=files
--EXTENSIONS--
session
--FILE--
<?php
ob_start();
// Procedural API has no return type enforcement, so gc can return a string
// (reference-counted), which PS_GC_FUNC(user) previously did not free.
session_set_save_handler(
function(string $path, string $name) { return true; },
function() { return true; },
function(string $id): string|false { return ""; },
function(string $id, string $data) { return true; },
function(string $id) { return true; },
function(int $max) { return str_repeat("x", 100); }
);
session_start();
$result = session_gc();
var_dump($result);
session_write_close();
ob_end_flush();
?>
--EXPECTF--
Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
bool(false)