Skip to content

fix: do not throw deprecated warning on field getters for default values#17788

Closed
bshaffer wants to merge 8 commits intoprotocolbuffers:mainfrom
bshaffer:wrap-deprecation-in-conditional
Closed

fix: do not throw deprecated warning on field getters for default values#17788
bshaffer wants to merge 8 commits intoprotocolbuffers:mainfrom
bshaffer:wrap-deprecation-in-conditional

Conversation

@bshaffer
Copy link
Contributor

fixes #13428

Wraps deprecated field getters in a conditional to see if the value has been set before throwing the warning. This is because this method is used internally, so users can get deprecated warnings even when they are not using the field.

@bshaffer bshaffer requested a review from a team as a code owner August 12, 2024 18:37
@bshaffer bshaffer requested review from anandolee and removed request for a team August 12, 2024 18:37
@bshaffer bshaffer added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 12, 2024
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 12, 2024
@bshaffer bshaffer requested a review from googleberg August 12, 2024 18:38
@bshaffer bshaffer added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 12, 2024
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 12, 2024
Copy link
Contributor Author

@bshaffer bshaffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's enough complexity around getting the field to even check if it's default... for instance, $this->readOneof should be called instead of the property name for "OneOf fields", and $this->readWrapperValue should be called for "wrapped" fields

@bshaffer bshaffer added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 13, 2024
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 13, 2024
@bshaffer bshaffer added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 13, 2024
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 13, 2024
@bshaffer bshaffer added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 20, 2024
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 20, 2024
@bshaffer bshaffer added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 20, 2024
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Aug 20, 2024
bshaffer added a commit to bshaffer/protobuf that referenced this pull request Apr 1, 2025
zhangskz pushed a commit that referenced this pull request Apr 21, 2025
…t values (#21033)

* fix(php): do not throw deprecated warning on field getters for default values (#17788)

backports fix for #13428 to 25.x branch

* fix deprecation_trigger generation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PHP: Deprecation message for "return_immediately" is thrown which is impossible to fix

2 participants