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

fix: prevent "Undefined index: post_type" notice #3981

Closed
ravinderk opened this issue Feb 3, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@ravinderk
Copy link
Collaborator

commented Feb 3, 2019

Bug Report

User Story

As an admin, I do not want any notice related to Give core.

Current Behavior

In few cases, if somehow post_type will not set in WordPress global query then we will get PHP notice.

if ( 'give_forms' !== $query->query_vars['post_type'] ) {

Expected Behavior

The plugin must load without any notice.

Bug Type

  • This bug describes functionality that once worked as expected in version X.X.X.
  • This bug describes functionality that never worked as expected.
  • I am not sure whether this functionality ever worked as expected.

Possible Solution

Use empty to check whether this param exist or not

Related

https://wordpress.org/support/topic/error-cannot-modify-header-information-14/
https://wordpress.org/support/topic/php-notice-undefined-index-post_type/

Acceptance Criteria

  • Plugin must load without any notice if post_type does not set.

@ravinderk ravinderk self-assigned this Feb 3, 2019

@ravinderk ravinderk closed this in fe69c34 Feb 4, 2019

ravinderk added a commit that referenced this issue Feb 4, 2019

fix: prevent PHP notice
When `post_type` does not exist in query_vars

fixes #3981
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.