Repository navigation
Open
Open
Copy link
Description
🐞 bug report
Behavior:
What is the issue? (*)
On a fresh first opt-in for a free-only plugin ('has_paid_plans' => false), two problems occur:
-
Warning: Undefined property: stdClass::$plan_id in .../freemius/includes/entities/class-fs-site.php on line 123
FS_Site::__construct()reads$site->plan_idwithout checking the property exists. -
Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in .../freemius/includes/class-freemius.php:19847
_store_plans()callscount( $this->_plans )while$this->_plansis still its initial valuefalse.
Reproduction: activate a free-only Freemius plugin on a clean WordPress install (PHP 8+) and complete the opt-in for the first time.
What is the expected behavior?
Opt-in completes without warnings or fatal errors when the plugin has no paid plans / the install object has noplan_id.
Versions: (*)
Freemius SDK Version:2.13.1 (code path also present in 2.13.4 / current develop)WordPress Version:6.9PHP Version:8.2
Plugin / Theme: (*)
Name:[redacted]Slug:[redacted]Freemius ID:[redacted]
Additional Information:
Browser Type: (*)ChromeBrowser Version: (*)latestOS: (*)Windows 10 (Local by Flywheel)Stack Traces:Fatal error: Uncaught TypeError: count(): Argument Better init for addons. #1 ($value) must be of type Countable|array, bool given in .../freemius/includes/class-freemius.php:19847 Stack trace: #0 .../class-freemius.php(20205): Freemius->store_plans(false) Better init for addons. #1 .../class-freemius.php(16797): Freemius->store_account() Error When using Your Example Plugin #2 .../class-freemius.php(18319): Freemius->set_account(Object(FS_User), Object(FS_Site)) Calling images remotely is not allowed! #3 .../class-freemius.php(17446): Freemius->handle_account_connection(Array, true) Upgrade menu added without paid plans #4 .../class-freemius.php(17387): Freemius->setup_network_account(Object(FS_User), Array, true, false, false) [bug-fix] [admin-menu] Wrapped upgrade menu in a conditional to check for paid plans - fixes #4 #5 .../class-freemius.php(17726): Freemius->setup_account(Object(FS_User), Object(FS_Site), true, false) Should redirect to plugin page not account page if account = false #6 .../class-freemius.php(17593): Freemius->install_with_new_user('[REDACTED]', 'pk[REDACTED]', 'sk[REDACTED]', true, true, true, '[REDACTED]', 'pk[REDACTED]', 'sk_[REDACTED]', true, false) Loading image on VVV does not work #7 .../class-freemius.php(18664): Freemius->_install_with_new_user() Activation fails if the plugin's dir is outside of the WP plugins folder and configured with symlinks #8 .../class-freemius.php(18537): Freemius->override_plugin_menu_with_activation() Double menu on WordPress 4.4 #9 .../class-freemius.php(18517): Freemius->add_menu_action() Plugin icon not loading on opt-in screen #10 .../wp-includes/class-wp-hook.php(341): Freemius->_prepare_admin_menu('')

Metadata
Metadata
Assignees
Labels
No labels
Activity
hammad-wpbrigade commentedon Jul 29, 2026
This issue is Already Fixed In Fix fatal error on first opt-in when plugin has no paid plans @ianmjones @sun
Tobias-Conrad commentedon Oct 7, 2026
Both symptoms in this report are still present on
master(2.13.4) and on 2.13.5, and they share one root cause:$this->_plansdefaults tofalseand_set_account()only assigns it when a plan list is passed, so on a fresh first opt-in without paid plans_store_plans()still callscount( $this->_plans )onfalse(fatal on PHP 8), andFS_Site::__construct()reads$site->plan_idwhich the payload can omit (warning).Opened a minimal fix for both with the class's existing
! is_array( $this->_plans )convention: #888Reproduced on a clean WordPress, PHP 8.2 first opt-in before the change; both diagnostics gone after.
php -lclean.patzman-one-two-three commentedon Oct 8, 2026
Also reproducible on SDK 2.13.4 (PHP 8.2) for a plugin with paid plans: if the plans request inside
setup_network_account()→_sync_plans()fails (timeout/network/API error),$this->_plansstaysfalseand the subsequent_set_account()→_store_account()→_store_plans()throwsTypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given(class-freemius.php,_store_plans). With a successful plans response the flow completes normally.A guard such as
if ( ! is_array( $this->_plans ) ) { $this->_plans = array(); }at the start of_store_plans()(or initialising the property toarray()) prevents the fatal error. We currently ship the unmodified SDK and would appreciate an upstream fix.