Fix JSON printing of Any of an empty message in C++Proto.
This check was likely based on confusion about presence: if the 'bytes' field of Any supported presence and was unset it would be a malformed message. However, as a Proto3 message the bytes field is implicit presence, and an empty message serializes to 0-bytes. It is perfectly valid to pack an empty message into an Any, and there's no distinguishing between "they forgot to set the value" and "actual zero-length serialization". This wasn't caught by a user sooner since it is already allowed when allow_legacy_nonconformant_behavior is on, and that setting is on by default and rarely disabled. https://github.com/protocolbuffers/protobuf/issues/24937 PiperOrigin-RevId: 848253357
P
Protobuf Team Bot committed
014f676e8898e0e47919911cb759094acf607236
Parent: dd7c6f8
Committed by Copybara-Service <copybara-worker@google.com>
on 12/23/2025, 8:01:11 PM