summaryrefslogtreecommitdiff
path: root/Zend/tests/traits/interface_003.phpt
blob: a1463113eba4fa8a22e86da6083b1adbf0636f67 (plain)
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
--TEST--
Testing to implement Serializable interface by traits
--FILE--
<?php

trait foo {
    public function serialize() {
        return 'foobar';
    }
    public function unserialize($x) {
        var_dump($x);
    }
}

class bar implements Serializable {
    use foo;
}

var_dump($o = serialize(new bar));
var_dump(unserialize($o));

?>
--EXPECTF--
string(20) "C:3:"bar":6:{foobar}"
string(6) "foobar"
object(bar)#%d (0) {
}