mirror of
https://github.com/php/php-src.git
synced 2026-04-12 18:43:37 +02:00
If Serializable is implemented, require that __serialize() and __unserialize() are implemented as well, else issue a deprecation warning. Also deprecate use of PDO::FETCH_SERIALIZE. RFC: https://wiki.php.net/rfc/phase_out_serializable Closes GH-6494.
25 lines
601 B
PHP
25 lines
601 B
PHP
--TEST--
|
|
Enum must not implement Serializable
|
|
--FILE--
|
|
<?php
|
|
|
|
enum Foo implements Serializable {
|
|
case Bar;
|
|
|
|
public function serialize() {
|
|
return serialize('Hello');
|
|
}
|
|
|
|
public function unserialize($data) {
|
|
return unserialize($data);
|
|
}
|
|
}
|
|
|
|
var_dump(unserialize(serialize(Foo::Bar)));
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d
|
|
|
|
Fatal error: Enums may not implement the Serializable interface in %s on line %d
|