Repository navigation
Conversation
get_activation() adds a notice on any API error, and add_settings_error() only exists in wp-admin. Calling it on init, the front end, REST, cron or WP-CLI fataled whenever the license API failed. Also bump to 1.2.3 and note in the README that bundled copies share one namespace.
mzakash
approved these changes
Oct 21, 2026
mzakash
deleted the
rajkiranb/sur-5958-licensing-sdk-settingsadd_notice-fatals-outside-wp-admin
branch
October 21, 2026 07:42
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.
Fixes SUR-5958 (surecart/surecart-wp#4463).
What changes
1. Skip notices when
add_settings_error()isn't loadedget_activation()adds a notice on any API error, andadd_notice()calledadd_settings_error()without a check. That function is defined inwp-admin/includes/template.php, which the SDK never loads. Callingget_activation()oninit, the front end, REST, cron or WP-CLI fataled withCall to undefined function SureCart\Licensing\add_settings_error()whenever the license API returned an error. A developer bundling the SDK hit this in production through a plugin that checks the license oninit.add_notice()now returns early when the function doesn't exist. The settings page still shows the notice, because it callsget_activation()again while rendering, whentemplate.phpis loaded.2. Bump to 1.2.3
3. README note on bundled copies
Every plugin that bundles the SDK shares the
SureCart\Licensingnamespace, so the first copy to load serves all of them, and an older copy can override fixes. The README now recommends prefixing the namespace with Strauss or PHP-Scoper.Testing
No unit test:
SettingsFormTestalready loadstemplate.php, soadd_settings_error()can't be made missing in the PHPUnit process. I verified with a standalone script that loads the real SDK files, makes the activation request return aWP_Error, and doesn't loadtemplate.php:http_request_failedSettings.php:416(object) ['id' => 'act_123'], options unchangednot_foundSettings.php:416false, options unchangedphp -lpasses on both files. phpcs wasn't run.Not included: loading the highest-versioned copy when several plugins bundle the SDK. That's a separate follow-up.
🤖 Generated with Claude Code