Protocol Buffers v4.0.0-rc1 Release Notes

Release Date: 2020-07-15 // over 2 years ago
  • 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).