The affiliate application template throws an uncaught fatal error when Freemius::get_affiliate_terms() returns null. The template does not guard against this case before calling a method on the result.
Environment
Freemius SDK version: 2.13.4
Integrating plugin: DSGVO Pixelmate (product slug: dsgvo-pixelmate)
WordPress admin, triggered via the plugin's own admin menu (affiliate / partner program page)
Error
PHP Fatal error: Uncaught Error: Call to a member function get_formatted_commission() on null in .../wp-content/plugins/dsgvo-pixelmate-premium/vendor/freemius/templates/forms/affiliation.php:31
Stack trace:
#0 .../vendor/freemius/includes/fs-core-functions.php(57): require()
#1 .../vendor/freemius/includes/class-freemius.php(23359): fs_get_template()
#2 .../wp-includes/class-wp-hook.php(341): Freemius->_affiliation_page_render()
#3 .../wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters()
#4 .../wp-includes/plugin.php(522): WP_Hook->do_action()
#5 .../wp-admin/admin.php(264): do_action()
#6 {main}
thrown in .../vendor/freemius/templates/forms/affiliation.php on line 31
Root cause
templates/forms/affiliation.php, line 31:
$affiliate_terms = $fs->get_affiliate_terms(); // line 25
...
$commission = $affiliate_terms->get_formatted_commission(); // line 31
Freemius::get_affiliate_terms() (includes/class-freemius.php, ~line 14564) is:
function get_affiliate_terms() {
return is_object( $this->custom_affiliate_terms ) ?
$this->custom_affiliate_terms :
$this->plugin_affiliate_terms;
}
$this->plugin_affiliate_terms can be null — e.g. when the affiliate program data for the product hasn't been fetched/synced yet, or the product's affiliate program isn't (currently) active for the account querying it. The template renders unconditionally and dereferences the result without a null/is_object() check, causing a hard fatal error (not just a PHP notice) that stops execution of the admin page.
Steps to reproduce
Install/activate a plugin integrating this SDK version.
Visit the plugin's affiliate/partner-program admin page while get_affiliate_terms() resolves to null (e.g. right after activation before the affiliate-terms API response has been cached, or for an account/product state where the affiliate program isn't available).
Fatal error is thrown; the admin page fails to render (white screen / error page), only visible to whoever opens that specific admin page.
Impact
Fatal error (not caught), so the affected admin page fails to load entirely for the user who opens it.
Front-end is unaffected — this code path only runs on the plugin's own wp-admin affiliate page — so end users/visitors never see this.
No security impact identified; this is a null-pointer dereference in vendored SDK code, not user-controlled input.
Suggested fix
Guard the template against a null $affiliate_terms before use, e.g.:
$affiliate_terms = $fs->get_affiliate_terms();
if ( ! is_object( $affiliate_terms ) ) {
// Show a fallback message / return early, instead of fataling.
return;
}
or make get_formatted_commission() safe to call by having get_affiliate_terms() never return null (return a default/empty FS_AffiliateTerms instance instead).
Happy to provide further details (site URL, account ID) privately if useful for debugging.
The affiliate application template throws an uncaught fatal error when Freemius::get_affiliate_terms() returns null. The template does not guard against this case before calling a method on the result.
Environment
Freemius SDK version: 2.13.4
Integrating plugin: DSGVO Pixelmate (product slug: dsgvo-pixelmate)
WordPress admin, triggered via the plugin's own admin menu (affiliate / partner program page)
Error
PHP Fatal error: Uncaught Error: Call to a member function get_formatted_commission() on null in .../wp-content/plugins/dsgvo-pixelmate-premium/vendor/freemius/templates/forms/affiliation.php:31
Stack trace:
#0 .../vendor/freemius/includes/fs-core-functions.php(57): require()
#1 .../vendor/freemius/includes/class-freemius.php(23359): fs_get_template()
#2 .../wp-includes/class-wp-hook.php(341): Freemius->_affiliation_page_render()
#3 .../wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters()
#4 .../wp-includes/plugin.php(522): WP_Hook->do_action()
#5 .../wp-admin/admin.php(264): do_action()
#6 {main}
thrown in .../vendor/freemius/templates/forms/affiliation.php on line 31
Root cause
templates/forms/affiliation.php, line 31:
$affiliate_terms = $fs->get_affiliate_terms(); // line 25
...
$commission = $affiliate_terms->get_formatted_commission(); // line 31
Freemius::get_affiliate_terms() (includes/class-freemius.php, ~line 14564) is:
function get_affiliate_terms() {
return is_object( $this->custom_affiliate_terms ) ?
$this->custom_affiliate_terms :
$this->plugin_affiliate_terms;
}
$this->plugin_affiliate_terms can be null — e.g. when the affiliate program data for the product hasn't been fetched/synced yet, or the product's affiliate program isn't (currently) active for the account querying it. The template renders unconditionally and dereferences the result without a null/is_object() check, causing a hard fatal error (not just a PHP notice) that stops execution of the admin page.
Steps to reproduce
Install/activate a plugin integrating this SDK version.
Visit the plugin's affiliate/partner-program admin page while get_affiliate_terms() resolves to null (e.g. right after activation before the affiliate-terms API response has been cached, or for an account/product state where the affiliate program isn't available).
Fatal error is thrown; the admin page fails to render (white screen / error page), only visible to whoever opens that specific admin page.
Impact
Fatal error (not caught), so the affected admin page fails to load entirely for the user who opens it.
Front-end is unaffected — this code path only runs on the plugin's own wp-admin affiliate page — so end users/visitors never see this.
No security impact identified; this is a null-pointer dereference in vendored SDK code, not user-controlled input.
Suggested fix
Guard the template against a null $affiliate_terms before use, e.g.:
$affiliate_terms = $fs->get_affiliate_terms();
if ( ! is_object( $affiliate_terms ) ) {
// Show a fallback message / return early, instead of fataling.
return;
}
or make get_formatted_commission() safe to call by having get_affiliate_terms() never return null (return a default/empty FS_AffiliateTerms instance instead).
Happy to provide further details (site URL, account ID) privately if useful for debugging.