php-src/Zend/tests/traits/interface_003.phpt
Felipe Pena c95b4ace40 - Fixed ZEND_VERIFY_ABSTRACT_CLASS order when using traits
# It's the last one now, thus the traits can be used to implement interfaces
2010-05-07 16:29:15 +00:00

28 lines
404 B
PHP

--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) {
}