Skip to content

Commit 660e15b

Browse files
authored
Merge pull request #156 from remicollet/issue-php81
Fix The Serializable interface is deprecated...
2 parents 06380d9 + fff660a commit 660e15b

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

tests/021.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ class Obj implements Serializable {
3838
$tmp = unpack('N*', $serialized);
3939
$this->__construct($tmp[1], $tmp[2]);
4040
}
41+
42+
public function __serialize() {
43+
return $this->serialize();
44+
}
45+
46+
public function __unserialize($serialized) {
47+
return $this->unserialize();
48+
}
4149
}
4250

4351
$o = new Obj(1, 2);

tests/031.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ class Obj implements Serializable {
4646
throw new Exception("exception in unserialize $c");
4747
}
4848
}
49+
50+
public function __serialize() {
51+
return $this->serialize();
52+
}
53+
54+
public function __unserialize($serialized) {
55+
return $this->unserialize();
56+
}
4957
}
5058

5159
$a = new Obj(1, 0);

tests/042.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ class Foo implements Serializable {
2323
public function unserialize($str) {
2424
echo "Should not be run.\n";
2525
}
26+
27+
public function __serialize() {
28+
return $this->serialize();
29+
}
30+
31+
public function __unserialize($serialized) {
32+
return $this->unserialize();
33+
}
2634
}
2735

2836
$array = array($closure, new Foo());

0 commit comments

Comments
 (0)