|
| 1 | ++++ |
| 2 | +title = "Changes Announced on September 19, 2025" |
| 3 | +linkTitle = "September 19, 2025" |
| 4 | +toc_hide = "true" |
| 5 | +description = "Changes announced for Protocol Buffers on September 19, 2025." |
| 6 | +type = "docs" |
| 7 | ++++ |
| 8 | + |
| 9 | +The following sections cover planned breaking changes in the v34 release, |
| 10 | +expected in 2026 Q1. These describe changes as we anticipate them being |
| 11 | +implemented, but due to the flexible nature of software some of these changes |
| 12 | +may not land or may vary from how they are described in this topic. |
| 13 | + |
| 14 | +## Changes in C++ {#cpp} |
| 15 | + |
| 16 | +C++ will bump its major version to 7 with the 7.34.0 release. 6.33 will be the |
| 17 | +final minor version release on 6.x |
| 18 | + |
| 19 | +### Removal of Future Macros {#cpp-remove-macros} |
| 20 | + |
| 21 | +The following macros, introduced for staged roll-out of breaking changes, will |
| 22 | +be removed and their behavior will become the default: |
| 23 | + |
| 24 | +* `PROTOBUF_FUTURE_RENAME_ADD_UNUSED_IMPORT` |
| 25 | +* `PROTOBUF_FUTURE_REMOVE_ADD_IGNORE_CRITERIA` |
| 26 | +* `PROTOBUF_FUTURE_STRING_VIEW_DESCRIPTOR_DATABASE` |
| 27 | +* `PROTOBUF_FUTURE_NO_RECURSIVE_MESSAGE_COPY` |
| 28 | + |
| 29 | +### New RepeatedPtrField Layout {#cpp-repeatedptrfield-layout} |
| 30 | + |
| 31 | +`RepeatedPtrField` will transition to a new internal element layout where |
| 32 | +elements are stored in contiguous chunks of preallocated memory, similar to |
| 33 | +`std::deque`. This results in some changes to copy/move semantics of some APIs, |
| 34 | +and some `UnsafeArena` APIs may become functional equivalents of their |
| 35 | +arena-safe counterparts and be deprecated. |
| 36 | + |
| 37 | +### MSB Hardening Check on RepeatedField::Get and RepeatedPtrField::Get {#cpp-repeatedfield-get-hardening} |
| 38 | + |
| 39 | +Protobufs will be hardened against OOB errors by adding comprehensive bounds |
| 40 | +checking to repeated field accesses. |
| 41 | + |
| 42 | +### Remove Arena Pointers from Repeated Fields {#cpp-remove-arena-pointers} |
| 43 | + |
| 44 | +The `RepeatedPtrField(Arena*)` constructor will be deleted. |
| 45 | + |
| 46 | +### Remove Deprecated APIs {#cpp-remove-apis} |
| 47 | + |
| 48 | +This release will remove the following public runtime APIs, which have been |
| 49 | +marked deprecated for at least one minor or major release and that are obsolete |
| 50 | +or replaced. |
| 51 | + |
| 52 | +#### AddUnusedImportTrackFile() and ClearUnusedImportTrackFiles() |
| 53 | + |
| 54 | +**API:** `AddUnusedImportTrackFile()`, `ClearUnusedImportTrackFiles()` |
| 55 | + |
| 56 | +**Replacement:** `AddDirectInputFile()` and `ClearDirectInputFiles()` |
| 57 | + |
| 58 | +#### AddIgnoreCriteria from message differencer |
| 59 | + |
| 60 | +`PROTOBUF_FUTURE_REMOVE_ADD_IGNORE_CRITERIA` was added for the breaking change. |
| 61 | +This release will remove the macro. |
| 62 | + |
| 63 | +**API:** `AddIgnoreCriteria()` |
| 64 | + |
| 65 | +**Replacement:** Wrap the raw pointer in a `unique_ptr`. |
| 66 | + |
| 67 | +#### FieldDescriptor::has_optional_keyword() |
| 68 | + |
| 69 | +**API:** `FieldDescriptor::has_optional_keyword()` |
| 70 | + |
| 71 | +**Replacement:** `has_presence()` |
| 72 | + |
| 73 | +#### FieldDescriptor::label() |
| 74 | + |
| 75 | +**API:** `FieldDescriptor::label()` |
| 76 | + |
| 77 | +**Replacement:** `is_repeated()` or `is_required()` |
| 78 | + |
| 79 | +#### FieldDescriptor::is_optional() |
| 80 | + |
| 81 | +**API:** `FieldDescriptor::is_optional()` |
| 82 | + |
| 83 | +**Replacement:** `!is_required() && !is_repeated()` |
| 84 | + |
| 85 | +#### UseDeprecatedLegacyJsonFieldConflicts() |
| 86 | + |
| 87 | +**API:** `UseDeprecatedLegacyJsonFieldConflicts()` |
| 88 | + |
| 89 | +**Replacement:** No replacement. |
| 90 | + |
| 91 | +### Stricter Name Length Limits {#cpp-name-limits} |
| 92 | + |
| 93 | +The protobuf compiler will enforce stricter limits on the length of symbol |
| 94 | +names, such as field names, to prevent potential issues. If the length of any |
| 95 | +field name is > 2^16, it will generate an error. |
| 96 | + |
| 97 | +### Hide Private Generator Headers in CMake {#cpp-cmake-headers} |
| 98 | + |
| 99 | +The protoc generator headers will no longer be installed by CMake. This should |
| 100 | +not affect most users. |
| 101 | + |
| 102 | +### [[nodiscard]] on Logically Constant Operations {#cpp-nodiscard} |
| 103 | + |
| 104 | +`[[nodiscard]]` will be added to several logically constant protobuf APIs where |
| 105 | +failure to consume the returned value indicates a probable bug. This follows |
| 106 | +patterns used commonly in the C++ standard library. |
| 107 | + |
| 108 | +## Changes in Python {#python} |
| 109 | + |
| 110 | +Python will bump its major version to 7 with the 7.34.0 release. 6.33 will be |
| 111 | +the final minor version release on 6.x |
| 112 | + |
| 113 | +There is no change in the gencode and we will relax the poison pills. No |
| 114 | +warnings or errors will be raised for old generated files for 7.34.x. |
| 115 | + |
| 116 | +### Raise TypeError on Incorrect Type Conversion to Timestamp/Duration {#python-type-error-timestamp-duration} |
| 117 | + |
| 118 | +This release will raise a `TypeError` instead of an `AttributeError` when |
| 119 | +converting an incorrect type to a `Timestamp` or `Duration`. |
| 120 | + |
| 121 | +### Reject bool to enum and int field {#python-reject-bool-enum-int} |
| 122 | + |
| 123 | +This release will reject setting enum or int fields with boolean values. The API |
| 124 | +will raise an error instead of implicitly converting them. |
| 125 | + |
| 126 | +### Remove float_precision from json_format {#python-remove-float-precision} |
| 127 | + |
| 128 | +This release will remove the deprecated `float_precision` option from the |
| 129 | +`json_format` serializer. This option does not exist in other ProtoJSON |
| 130 | +serializers and has confusing semantics. |
| 131 | + |
| 132 | +### Remove float_format/double_format from text_format {#python-remove-text-format-options} |
| 133 | + |
| 134 | +This release will remove the deprecated `float_format` and `double_format` |
| 135 | +options from `text_format`. These options are not available in other proto text |
| 136 | +format serializers. |
| 137 | + |
| 138 | +### Remove Deprecated APIs {#python-remove-apis} |
| 139 | + |
| 140 | +This release will remove the following public runtime APIs. |
| 141 | + |
| 142 | +#### FieldDescriptor.label |
| 143 | + |
| 144 | +**API:** `FieldDescriptor.label` |
| 145 | + |
| 146 | +**Replacement:** Use `is_repeated()` or `is_required()`. |
| 147 | + |
| 148 | +## Changes in PHP {#php} |
| 149 | + |
| 150 | +PHP will bump its major version to 5 with the 5.34.0 release. 4.33 will be the |
| 151 | +final minor version release on 4.x |
| 152 | + |
| 153 | +### Remove Deprecated APIs {#php-remove-apis} |
| 154 | + |
| 155 | +This release will remove the following public runtime APIs. |
| 156 | + |
| 157 | +#### FieldDescriptor getLabel |
| 158 | + |
| 159 | +**API:** `FieldDescriptor getLabel` |
| 160 | + |
| 161 | +**Replacement:** `isRepeated()` or `isRequired()` |
| 162 | + |
| 163 | +#### Google\Protobuf\Field_Kind |
| 164 | + |
| 165 | +**API:** `Google\Protobuf\Field_Kind` |
| 166 | + |
| 167 | +**Replacement:** `Google\Protobuf\Field\Kind` |
| 168 | + |
| 169 | +#### Google\Protobuf\Field_Cardinality |
| 170 | + |
| 171 | +**API:** `Google\Protobuf\Field_Cardinality` |
| 172 | + |
| 173 | +**Replacement:** `Google\Protobuf\Field\Cardinality` |
| 174 | + |
| 175 | +#### Google\Protobuf\Internal\RepeatedField |
| 176 | + |
| 177 | +**API:** `Google\Protobuf\Internal\RepeatedField` |
| 178 | + |
| 179 | +**Replacement:** `Google\Protobuf\RepeatedField` |
| 180 | + |
| 181 | +### JSON Parsing Strictness {#php-json-parsing} |
| 182 | + |
| 183 | +The JSON parser will become stricter and reject several cases that were |
| 184 | +previously accepted. This includes out-of-bound values, non-integer numeric |
| 185 | +values for integer fields, duplicate oneof fields, and non-string values for |
| 186 | +string fields. The JSON serializer will also reject `Infinity` and `NaN` for |
| 187 | +number values. |
| 188 | + |
| 189 | +### Fix Silent Ignoring of Default Values {#php-fix-default-values} |
| 190 | + |
| 191 | +The PHP runtime will be fixed to honor default values on scalar fields in proto2 |
| 192 | +and editions, instead of silently ignoring them. |
| 193 | + |
| 194 | +### Type Checking Alignment {#php-type-checking} |
| 195 | + |
| 196 | +Type checking for pure-PHP and upb-PHP implementations will be aligned. Notably, |
| 197 | +pure-PHP will reject `null` for string fields, matching the behavior of upb-PHP. |
| 198 | + |
| 199 | +## Changes in Objective-C {#objc} |
| 200 | + |
| 201 | +Objective-C will bump its major version to 5 with the 5.34.0 release. 4.33 will |
| 202 | +be the final minor version release on 4.x |
| 203 | + |
| 204 | +The nullability annotations for some `GPB*Dictionary` APIs will be corrected to |
| 205 | +mark when APIs could return `nil`. This will result in Swift code getting a |
| 206 | +Swift `Optional<T>` and thus becoming a breaking API change. For Objective-C |
| 207 | +callers, the annotation correction is less likely to have any impact on the |
| 208 | +source code. |
| 209 | + |
| 210 | +### Remove Deprecated APIs {#objc-remove-apis} |
| 211 | + |
| 212 | +This release will remove the following public runtime APIs. |
| 213 | + |
| 214 | +#### -[GPBFieldDescriptor optional] |
| 215 | + |
| 216 | +**API:** `-[GPBFieldDescriptor optional]` |
| 217 | + |
| 218 | +**Replacement:** Use `!required && fieldType == GPBFieldTypeSingle` instead. |
| 219 | + |
| 220 | +## Other Changes {#other-changes} |
| 221 | + |
| 222 | +The following are additional breaking changes. |
| 223 | + |
| 224 | +### Bazel: Remove deprecated ProtoInfo.transitive_imports {#bazel-transitive-imports} |
| 225 | + |
| 226 | +The deprecated `transitive_imports` field in `ProtoInfo` will be removed. Users |
| 227 | +should migrate to `transitive_sources`. |
| 228 | + |
| 229 | +### Remove protobuf_allow_msvc flag and continue support Bazel+MSVC {#remove-protobuf_allow_msvc} |
| 230 | + |
| 231 | +Due to Bazel's recent improvements on Windows, we now plan to continue to |
| 232 | +support Bazel+MSVC. The `--define=protobuf_allow_msvc` flag will be removed. |
| 233 | + |
| 234 | +### Languages Without a Major Version Bump |
| 235 | + |
| 236 | +Java, Ruby, C#, Rust, and JRuby will not have a major version bump in this |
| 237 | +release. |
0 commit comments