Skip to content

Conversation

@obenland
Copy link
Member

Fixes #1565.

Proposed changes:

  • Adds an explicit check for false values when evaluating getter results.

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Go to '..'

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

Transformers allow settings values to false again, a regression from 5.5.0.

@Menrath

@obenland obenland requested a review from a team April 10, 2025 16:59
@obenland obenland self-assigned this Apr 10, 2025
@pfefferle
Copy link
Member

I think we should unify all of the transformation methods!

See #1568

@pfefferle
Copy link
Member

I think it is fine to use isset( $value ) for everything. We should skip null, but I think false, '' and array() are fine.

@pfefferle
Copy link
Member

and we should also check the rest of the code. there is at least the from_array, that needs to be also fixed.

@obenland obenland merged commit 242a39a into trunk Apr 10, 2025
11 checks passed
@obenland obenland deleted the fix/set-properties-false branch April 10, 2025 19:52
@Menrath
Copy link
Contributor

Menrath commented Apr 11, 2025

I think it is fine to use isset( $value ) for everything. We should skip null, but I think false, '' and array() are fine.

Note that we in the events world have a case where a decidated null might have information, but as long as one can still can the setter manually this is totally fine.

jsit added a commit to jsit/wordpress-activitypub that referenced this pull request Nov 1, 2025
* tag '5.7.0': (29 commits)
  Release 5.7.0 (Automattic#1574)
  Fix: Show error if site uses "Almost Pretty Permalink" structure (Automattic#1570)
  Admin: Add padding to extra fields nav links (Automattic#1569)
  Signature: Add compat for more key encodings (Automattic#1557)
  Reply block: Improve fallback embed (Automattic#1560)
  Add label for "Health Check" and "REST API" (Automattic#1571)
  change changelog items (Automattic#1572)
  Transformers: Allow setting properties to false. (Automattic#1567)
  Upgrades: Delete orphaned extra fields (Automattic#1566)
  Fix: Missing Actor in Outbox-Activities (Automattic#1564)
  Outbox: Properly handle username requests (Automattic#1559)
  Import: Load on admin_init (Automattic#1561)
  Move: support same-server domain migrations (Automattic#1530)
  Follow Me: add a button-only mode (Automattic#1133)
  Tests: Convert timestamp to int for comparison (Automattic#1556)
  Reply: Make Mastodon embeds work (Automattic#1555)
  Add: `Vary` header settings (Automattic#1552)
  Actors: Don't convert non-numeric strings to Blog user id (Automattic#1554)
  Add: Shared Inbox setting (Automattic#1553)
  Add: New Health checks (Automattic#1524)
  ...
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.

Bug: Transformer does not allow setting attribute/property to false

5 participants