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

Ensure the default key is set before we try accessing it #650

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

dkotter
Copy link
Collaborator

@dkotter dkotter commented Jan 4, 2024

Description of the Change

When we get our prompts, we check which one is marked as the default. If we try and do this before prompts have been saved though, the default key isn't set and will result in an undefined index warning. This PR addresses that by checking to ensure that key exists before we access it.

Closes #648

How to test the Change

  1. On a new install, install ClassifAI from the develop branch
  2. Go to the Site Health screen (/wp-admin/site-health.php?tab=debug)
  3. You should see a PHP notice
  4. Checkout this PR and run the same steps
  5. The notice should no longer show

Changelog Entry

Fixed - Check for the default array key before we access it

Credits

Props @dkotter, @Sidsector9

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@dkotter dkotter added this to the 3.0.0 milestone Jan 4, 2024
@dkotter dkotter requested a review from jeffpaul as a code owner January 4, 2024 17:15
@dkotter dkotter self-assigned this Jan 4, 2024
@dkotter dkotter requested a review from a team as a code owner January 4, 2024 17:15
@dkotter dkotter removed request for a team and jeffpaul January 4, 2024 17:16
@Sidsector9 Sidsector9 merged commit 064add6 into develop Jan 8, 2024
13 checks passed
@Sidsector9 Sidsector9 deleted the fix/648 branch January 8, 2024 02:41
@dkotter dkotter modified the milestones: 3.0.0, 2.5.1 Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Site info breaks with a notice
2 participants