mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
27 lines
404 B
PHP
27 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) {
|
|
}
|