WPManageNinja / easy-code-manager

The High-Performance File Based Code Snippet Plugin for WP
https://fluentsnippets.com
23 stars 8 forks source link

Undefined offset notice on AdminMenuHandler #1

Closed rafiahmedd closed 1 year ago

rafiahmedd commented 1 year ago

When someone installs the plugin and there's no data on the db it throws two notices of undefined index '0' & '1' for tags and groups. Moreover, as tags and groups get assigned as non-array on appVars we can't create tags and groups from the CreateSnippet module. I found a fix for this.

On the AdminMenuHandler we can assign tags and groups as empty arrays if there's no data available. AdminMenuHandler line number 43.

[$tags, $groups] = (new Snippet())->getAllSnippetTagsGroups() ?: [[], []];

techjewel commented 1 year ago

Thanks @rafiahmedd . I have fixed it from the getAllSnippetTagsGroups method. Which should be ideal place to fix the issue.