Prevent strip_tags() deprecation notices with add_submenu_page()#23003
Merged
leonidasmi merged 8 commits intoYoast:trunkfrom Mar 6, 2026
Merged
Prevent strip_tags() deprecation notices with add_submenu_page()#23003leonidasmi merged 8 commits intoYoast:trunkfrom
strip_tags() deprecation notices with add_submenu_page()#23003leonidasmi merged 8 commits intoYoast:trunkfrom
Conversation
2 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses PHP 8.1+ deprecation notices (strip_tags(null)) on specific Yoast admin pages by ensuring the affected “hidden/dummy” admin pages are registered via add_submenu_page() with a valid parent slug.
Changes:
- Update several
add_submenu_page()calls to useoptions.phpas the parent slug (instead of an empty string). - Align unit tests with the updated
add_submenu_page()expectations.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/integrations/settings-integration.php |
Registers the settings “saved” dummy page under options.php to avoid null-title edge cases. |
src/integrations/admin/old-configuration-integration.php |
Registers the old configurator redirect page under options.php to prevent deprecation noise. |
src/integrations/admin/installation-success-integration.php |
Registers the installation success page under options.php so WP can resolve a non-null page title. |
src/dashboard/user-interface/setup/setup-url-interceptor.php |
Registers the Site Kit setup in-between page under options.php to avoid null-title behavior. |
tests/Unit/Integrations/Settings_Integration_Test.php |
Updates expected add_submenu_page() parent slug to options.php. |
tests/Unit/Integrations/Admin/Old_Configuration_Integration_Test.php |
Updates expected add_submenu_page() parent slug to options.php. |
tests/Unit/Integrations/Admin/Installation_Success_Integration_Test.php |
Updates expected add_submenu_page() parent slug to options.php. |
tests/Unit/Dashboard/User_Interface/Setup/Setup_Url_Interceptor_Add_Redirect_Page_Test.php |
Updates expected add_submenu_page() parent slug to options.php. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
leonidasmi
approved these changes
Mar 6, 2026
Contributor
leonidasmi
left a comment
There was a problem hiding this comment.
CR + Acceptance is ✅
Thanks for contributing!
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.
Context
To prevent deprecation notices on any administration page, #19124 and #19191 changed the
nullvalue for parent slug inadd_submenu_page()functions to an empty string. However, the empty string can still result in one deprecation notice on specific Yoast SEO pages.Deprecated: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in ...\wp-admin\admin-header.php on line 41Summary
This PR can be summarized in the following changelog entry:
Deprecated: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecatednotices appeared on certain actions, like when activating the plugin, or saving a Yoast setting. Props to @sabernhardt.For comparison, Yoast SEO 19.12 listed the change from
nullto empty string under the "Other" heading:Relevant technical choices:
nullbefore mentioning the possibility of using a string value.Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps (combining steps from PR 19191 and issue 22029):
installation-success-integration, open{site_url}/wp-admin/admin.php?page=wpseo_installation_successful_free. Its main heading should be "You've successfully installed Yoast SEO!" (or a translation). With the PR applied, the page<title>would start with "Installation Successful" and the deprecation notice should not appear on the page or in the debug log.settings-integration, navigate directly to{site_url}/wp-admin/admin.php?page=wpseo_page_settings_savedand confirm that you dont get deprecation notices in the debug.log.old-configuration-integration, there were no deprecation messages ever shown because we redirect immediately, but we changed it like the other places, to keep things aligned.{site_url}/wp-admin/admin.php?page=wpseo_configuratorand make sure you get redirected to{site_url}/wp-admin/admin.php?page=wpseo_dashboard#top#first-time-configuration.setup-url-interceptor, there were no deprecation messages ever shown because we redirect immediately, but we changed it like the other places, to keep things aligned.Relevant test scenarios
Test instructions for QA when the code is in the RC
QA can test this PR by following these steps:
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
Other environments
[shopify-seo], added test instructions for Shopify and attached theShopifylabel to this PR.[yoast-doc-extension], added test instructions for Yoast SEO for Google Docs and attached theGoogle Docs Add-onlabel to this PR.Documentation
Quality assurance
grunt build:imagesand commited the results, if my PR introduces new images or SVGs.Innovation
innovationlabel.Fixes #22029