--TEST-- Test refusing to serialize/unserialize unserializable internal classes --INI-- error_reporting=E_ALL --SKIPIF-- --FILE-- getMessage() . "\n"; } } class Something extends CURLFile { public function __serialize() { return []; } public function __unserialize($value) { return new self('file'); } } check_serialize_throws(new CURLFile('file')); check_serialize_throws(new Something('file')); ?> --EXPECTF-- Caught: Serialization of 'CURLFile' is not allowed Caught: Serialization of 'Something' is not allowed