Protocol Buffers v4.0.0-rc2 Release Notes

Release Date: 2020-07-21 // almost 4 years ago

Previous changes from v4.0.0-rc1

  • Note: This release bumps the major version due to backward-incompatible changes in PHP.

    PHP is the only language that has breaking changes in this release.


    • The C extension is completely rewritten. The new C extension has significantly
      ๐Ÿ‘ better parsing performance and fixes a handful of conformance issues. It will
      ๐Ÿ‘ also make it easier to add support for more features like proto2 and proto3 presence.
    • ๐Ÿ‘ The new C extension does not support PHP 5.x, which is the reason for the major
      ๐Ÿ”– version bump. PHP 5.x users can still use pure-PHP.


    • โœ‚ Removed deprecated unsafe arena string accessors
    • Enabled heterogeneous lookup for std::string keys in maps.
    • โœ‚ Removed implicit conversion from StringPiece to std::string
    • ๐Ÿ›  Fix use-after-destroy bug when the Map is allocated in the arena.
    • ๐Ÿ‘Œ Improved the randomness of map ordering
    • โž• Added stack overflow protection for text format with unknown fields
    • ๐Ÿ‘‰ Use std::hash for proto maps to help with portability.
    • โž• Added more Windows macros to proto whitelist.
    • Arena constructors for map entry messages are now marked "explicit"
      (for regular messages they were already explicit).
    • ๐Ÿ›  Fix subtle aliasing bug in RepeatedField::Add
    • ๐Ÿ›  Fix mismatch between MapEntry ByteSize and Serialize with respect to unset


    • ๐Ÿ›  JSON format conformance fixes:
      • Reject lowercase t for Timestamp json format.
      • Print full_name directly for extensions (no camelCase).
      • Reject boolean values for integer fields.
      • Reject NaN, Infinity, -Infinity that is not quoted.
      • Base64 fixes for bytes fields: accept URL-safe base64 and missing padding.
    • ๐Ÿ›  Bugfix for fields/files named "async" or "await".
    • Improved the error message when AttributeError is returned from getattr
      in EnumTypeWrapper.


    • ๐Ÿ›  Fixed a bug where setting optional proto3 enums with setFooValue() would
      not mark the value as present.
    • โž• Add Subtract function to FieldMaskUtil.


    • โฌ‡๏ธ Dropped support for netstandard1.0 (replaced by support for netstandard1.1).
      ๐Ÿ“œ This was required to modernize the parsing stack to use the Span<byte>
      type internally. (#7351)
    • โž• Add ParseFrom(ReadOnlySequence<byte>) method to enable GC friendly
      ๐Ÿ“œ parsing with reduced allocations and buffer copies. (#7351)
    • โž• Add support for serialization directly to a IBufferWriter<byte> or
      to a Span<byte> to enable GC friendly serialization.
      The new API is available as extension methods on the IMessage type. (#7576)
      generated code compatible with old C# compilers (pre-roslyn compilers
      ๐Ÿ‘ from .NET framework and old versions of mono) that do not support
      ref structs. Users that are still on a legacy stack that does
      ๐Ÿ‘ not support C# 7.2 compiler might need to use the new define
      ๐Ÿ— in their projects to be able to build the newly generated code. (#7490)
    • ๐Ÿ“œ Due to the major overhaul of parsing and serialization internals (#7351 and #7576),
      it is recommended to regenerate your generated code to achieve the best
      ๐ŸŽ performance (the legacy generated code will still work, but might incur
      ๐ŸŽ a slight performance penalty).