File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff 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 );
Original file line number Diff line number Diff 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 );
Original file line number Diff line number Diff 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 ());
You can’t perform that action at this time.
0 commit comments