-
Notifications
You must be signed in to change notification settings - Fork 326
/
Copy pathfetchall_badunserialize.phpt
63 lines (52 loc) · 1.13 KB
/
fetchall_badunserialize.phpt
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
--TEST--
Memcached::fetch() with bad unserialize
--SKIPIF--
<?php include "skipif.inc";?>
--FILE--
<?php
include dirname(__FILE__) . '/config.inc';
$m = memc_get_instance ();
class Foo implements Serializable {
public $serialize_throws = false;
public function __sleep() {
if ($this->serialize_throws) {
throw new Exception("12");
}
return array();
}
public function __wakeup() {
throw new Exception("1234567890");
}
public function serialize() {
if ($this->serialize_throws) {
throw new Exception("1234");
}
return "1234";
}
public function unserialize($str) {
throw new Exception("123456");
}
public function __serialize() {
if ($this->serialize_throws) {
throw new Exception("1234");
}
return ["1234"];
}
public function __unserialize($str) {
throw new Exception("123456");
}
}
$data = new Foo();
$m->set('foo', $data, 10);
error_reporting(0);
var_dump($m->getDelayed(array('foo'), false));
try {
var_dump($m->fetchAll());
} catch (Exception $e) {
echo error_get_last()["message"], "\n";
echo $e->getMessage(), "\n";
}
--EXPECTF--
bool(true)
Memcached::%s(): could not unserialize value%S
123456