-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
This ticket originally reported deprecation warnings related to Serializable, but also included warnings for PHPC not correctly specifying the return type in its arginfo for implementations of JsonSerializable::jsonSerialize().
Since PHPC-1849 is already being used to track Serializable changes, this ticket can be repurposed for JsonSerializable. A possible fix may resemble what was recently done for SplFixedArray in php/php-src@805471e.
Original description: Since a recent build of PHP 8.1 (master), the Serializable interface is deprecated, and as that's extensively used for the BSON types, we get a lot of warnings, even when just loading the extension:
Deprecated: Declaration of MongoDB\BSON\Binary::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed in Unknown on line 0 Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in Unknown on line 0 Deprecated: Declaration of MongoDB\BSON\DBPointer::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed in Unknown on line 0 Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in Unknown on line 0 Deprecated: Declaration of MongoDB\BSON\Decimal128::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed in Unknown on line 0 Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in Unknown on line 0 Deprecated: Declaration of MongoDB\BSON\Int64::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed in Unknown on line 0 Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in Unknown on line 0 Deprecated: Declaration of MongoDB\BSON\Javascript::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed in Unknown on line 0 Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in Unknown on line 0 Deprecated: Declaration of MongoDB\BSON\MaxKey::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed in Unknown on line 0 Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in Unknown on line 0 Deprecated: Declaration of MongoDB\BSON\MinKey::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed in Unknown on line 0 Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in Unknown on line 0 Deprecated: Declaration of MongoDB\BSON\ObjectId::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed in Unknown on line 0 Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in Unknown on line 0 Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in Unknown on line 0 Deprecated: Declaration of MongoDB\BSON\Regex::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed in Unknown on line 0 Deprecated: Declaration of MongoDB\BSON\Symbol::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed in Unknown on line 0 Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in Unknown on line 0 Deprecated: Declaration of MongoDB\BSON\Timestamp::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed in Unknown on line 0 Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in Unknown on line 0 Deprecated: Declaration of MongoDB\BSON\Undefined::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed in Unknown on line 0 Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP_SAPI : PHP versions is necessary) in Unknown on line 0 Deprecated: Declaration of MongoDB\BSON\UTCDateTime::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed in Unknown on line 0 Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in Unknown on line 0 Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in Unknown on line 0 Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in Unknown on line 0 Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in Unknown on line 0 Deprecated: The Serializable interface is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in Unknown on line 0
- is related to
-
PHPC-1709 PHPC typing improvements
- Development Complete
-
PHPC-1849 Handle deprecation of Serializable in PHP 8.1
- Closed
- related to
-
PHPC-1939 Create common arginfo for jsonSerialize methods and share among BSON classes
- Closed
-
PHPC-1933 Add return type to arginfo for Iterator and Countable methods in PHP 8.1
- Closed
- links to