Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Missing isset key check before setting variable against value #3769

Closed
1 task done
tropicandid opened this issue Nov 17, 2023 · 0 comments · Fixed by #3781
Closed
1 task done

BUG: Missing isset key check before setting variable against value #3769

tropicandid opened this issue Nov 17, 2023 · 0 comments · Fixed by #3781
Labels
bug Something isn't working
Milestone

Comments

@tropicandid
Copy link

Describe the bug

Within the elasticpress plugin for Wordpress, in the file /includes/classes/Feature/Facets/FacetType.php on line 114, there is no check to see if the array key for $block['attrs']['facet'] is set before attempting to set the $acc[] variable record to it. This throws an 'Undefined array key' warning in certain cases.

Recommendation to wrap code like so

if( isset( $block['attrs']['facet'] ) ) { $acc[] = $block['attrs']['facet']; }

Steps to Reproduce

  1. Install the plugin and activate
  2. Add a filter by taxonomy block or any other filter block to a page and load it.
  3. Warnings about the missing key will appear depending on your logging settings.

Screenshots, screen recording, code snippet

Screenshot 2023-11-17 at 10 22 46 AM

Environment information

No response

WordPress and ElasticPress information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@tropicandid tropicandid added the bug Something isn't working label Nov 17, 2023
@felipeelia felipeelia added this to the 5.1.0 milestone Nov 20, 2023
@felipeelia felipeelia modified the milestones: 5.1.0, 5.0.1 Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants