Add return type to arginfo for JsonSerializable::jsonSerialize() in PHP 8.1

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 1.11.0-alpha1, 1.11.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • 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
      

            Assignee:
            Jeremy Mikola
            Reporter:
            Derick Rethans
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: