php-src/Zend/tests/bug64354.phpt
Jeremy Mikola 858d0c0916 Include class name in Serializable deprecation message
The deprecation message was originally introduced in 3e6b447 (#6494).

I first encountered this notice when testing the MongoDB extension
with PHP 8.1, which produced many duplicate messages that provided
no detail about the particular class that needed to be fixed.

Closes GH-7346.
2021-08-11 10:35:47 +02:00

26 lines
644 B
PHP

--TEST--
Bug #64354 (Unserialize array of objects whose class can't be autoloaded fail)
--FILE--
<?php
class B implements Serializable {
public function serialize() {
throw new Exception("serialize");
return NULL;
}
public function unserialize($data) {
}
}
$data = array(new B);
try {
serialize($data);
} catch (Exception $e) {
var_dump($e->getMessage());
}
?>
--EXPECTF--
Deprecated: B implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d
string(9) "serialize"