stklcode / statify-blacklist

Filter extension for the Statify WordPress plugin
https://wordpress.org/plugins/statify-blacklist/
GNU General Public License v2.0
2 stars 1 forks source link

fix option upgrade routine #31

Closed stklcode closed 9 months ago

stklcode commented 9 months ago

Upgrading options without changes utilizes array_merge_recursive() to merge (potentially updated) default settings with current options.

With something like

[
  'active' => 1,
  ...
]

and default

[
  'active' => 1,
  ...
]

this results in

[
  'active' => [ 0, 1 ],
  ...
]

Because we have custom routines in place for 1.4 and 1.6 and we skipped 1.5 this was not a real issue. Noticed when updating the version to 1.7 without option changes.

Replace the merge function by array_replace_recursive() resolves the issue for now.

sonarcloud[bot] commented 9 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication