File: includes/modules/version-control/class-beta-optin.php
Line: ~106
PHP Version: 8.1+
Description:
When the get_plugin_info() call returns an array without the versions key (due to a missing or stale transient, or failed remote fetch), the following warning appears:
Warning: Undefined array key "versions" in .../class-beta-optin.php on line 106
How to Reproduce:
- Programmatically clear the
update_plugins site transient and rank_math_trunk_version transient.
- Load the Plugins screen or any admin screen that triggers
Beta_Optin::get_available_versions().
- If the transient isn't yet repopulated fully, the
versions key may be missing — triggering the warning.
Suggested Fix:
Replace line:
php foreach ( (array) $plugin_info['versions'] as $version => $url ) {
With:
php foreach ( (array) ($plugin_info['versions'] ?? []) as $version => $url ) {
This makes it compatible with PHP 8+ and avoids noise when the plugin info is incomplete.
This error only affects environments with strict PHP error reporting or uninitialized update transients, but it's easy to fix and safe to patch.
Thanks for the great plugin!
File:
includes/modules/version-control/class-beta-optin.phpLine: ~106
PHP Version: 8.1+
Description:
When the
get_plugin_info()call returns an array without theversionskey (due to a missing or stale transient, or failed remote fetch), the following warning appears:Warning: Undefined array key "versions" in .../class-beta-optin.php on line 106
How to Reproduce:
update_pluginssite transient andrank_math_trunk_versiontransient.Beta_Optin::get_available_versions().versionskey may be missing — triggering the warning.Suggested Fix:
Replace line:
php foreach ( (array) $plugin_info['versions'] as $version => $url ) {With:
php foreach ( (array) ($plugin_info['versions'] ?? []) as $version => $url ) {This makes it compatible with PHP 8+ and avoids noise when the plugin info is incomplete.
This error only affects environments with strict PHP error reporting or uninitialized update transients, but it's easy to fix and safe to patch.
Thanks for the great plugin!