Skip to content

Commit 5999f7f

Browse files
committed
[static-analysis] Fix rule - Access to an undefined property object .
1 parent 0ebb174 commit 5999f7f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

includes/fs-plugin-info-dialog.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ function _get_addon_info_filter( $data, $action = '', $args = null ) {
209209
} else {
210210
// Couldn't find plugin on .org.
211211
$selected_addon->is_wp_org_compliant = false;
212-
$data->wp_org_missing = true;
212+
213+
// Plugin is missing, not on Freemius nor WP.org.
214+
$data->wp_org_missing = true;
213215
}
214216

215217
$data->fs_missing = ( ! $has_free_plan || $data->wp_org_missing );

templates/plugin-info/features.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121

2222
$features_plan_map = array();
2323
foreach ( $plans as $plan ) {
24+
/**
25+
* @var FS_Plugin_Plan $plan
26+
*/
2427
if (!empty($plan->features) && is_array($plan->features)) {
2528
foreach ( $plan->features as $feature ) {
26-
$features_plan_map[ $feature->id ] = array( 'feature' => $feature, 'plans' => array() );
27-
28-
if ( ! empty( $plan->id ) ) {
29-
$features_plan_map[ $feature->id ]['plans'][ $plan->id ] = $feature;
29+
if ( ! isset( $features_plan_map[ $feature->id ] ) ) {
30+
$features_plan_map[ $feature->id ] = array( 'feature' => $feature, 'plans' => array() );
3031
}
32+
$features_plan_map[ $feature->id ]['plans'][ $plan->id ] = $feature;
3133
}
3234
}
3335

0 commit comments

Comments
 (0)