Use nodeinfo_discovery hook instead of deprecated wellknown_nodeinfo_data#3347
Merged
Conversation
…data The standalone NodeInfo plugin deprecated the wellknown_nodeinfo_data filter in v3.0.0 in favor of nodeinfo_discovery. Because the integration still registered a callback on the old name, NodeInfo 3.x emitted a PHP deprecation notice on every /.well-known/nodeinfo request. Switch the registration to nodeinfo_discovery (same data shape, so the callback is unchanged) and update the integration tests accordingly.
There was a problem hiding this comment.
Pull request overview
Updates the ActivityPub plugin’s NodeInfo integration to avoid triggering a deprecation notice in NodeInfo plugin v3.x by registering on the replacement discovery hook.
Changes:
- Switch the NodeInfo discovery filter registration from the deprecated
wellknown_nodeinfo_datahook tonodeinfo_discovery. - Update integration tests to assert the new hook is registered and exercised.
- Add a changelogger entry documenting the deprecation-notice fix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
integration/class-nodeinfo.php |
Registers the integration callback on nodeinfo_discovery instead of the deprecated hook. |
tests/phpunit/tests/integration/class-test-nodeinfo.php |
Updates hook registration assertions and integration hook test to use nodeinfo_discovery. |
.github/changelog/fix-nodeinfo-discovery-deprecation |
Documents the fix for deprecation notices when NodeInfo is active. |
The nodeinfo_discovery filter always receives a document that already contains a links array, so reflect that in the integration test input.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes:
The standalone NodeInfo plugin deprecated its
wellknown_nodeinfo_datafilter in v3.0.0 in favor ofnodeinfo_discovery. Our NodeInfo integration still registered its callback on the old hook name, so on sites running NodeInfo 3.x a PHP deprecation notice was logged on every/.well-known/nodeinfodiscovery request:add_filter()registration inintegration/class-nodeinfo.phpfromwellknown_nodeinfo_datatonodeinfo_discovery. The new hook passes the samearray( 'links' => … )discovery document, so the callback that appends the Application link is unchanged.Because nothing in the plugin hooks
wellknown_nodeinfo_dataanymore, NodeInfo's backwards-compat shim short-circuits (has_filter()is false) and the notice stops.Note: sites still running NodeInfo < 3.0.0 (which predates
nodeinfo_discovery) will no longer have the Application link added to their discovery document. NodeInfo 3.0.0 has been available for a while, so this is considered acceptable.Other information:
Updated the existing
Test_Nodeinfointegration tests (20 tests, 99 assertions, all passing) to cover the new hook.Testing instructions:
WP_DEBUGandWP_DEBUG_LOG./.well-known/nodeinfo(or/wp-json/...discovery), e.g.curl https://example.com/.well-known/nodeinfo.wp-content/debug.logshows awellknown_nodeinfo_data is deprecatednotice for each request. After this change, no such notice appears.relhttps://www.w3.org/ns/activitystreams#Application).Changelog entry
A changelog entry is included at
.github/changelog/fix-nodeinfo-discovery-deprecation.