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

Trying to access 'private' key when field is false #873

Closed
fpcorso opened this issue Aug 20, 2020 · 3 comments
Closed

Trying to access 'private' key when field is false #873

fpcorso opened this issue Aug 20, 2020 · 3 comments
Labels
Milestone

Comments

@fpcorso
Copy link
Contributor

fpcorso commented Aug 20, 2020

Describe the bug

After de-activating Videos, Scheduling, or Forced Interaction, a warning begins to appear when viewing pages that popups are loaded on.

Site information

Popup Maker version: 1.12

WordPress version: 5.5

PHP version: 7.4

Errors

Error originating from this line: https://github.com/PopupMaker/Popup-Maker/blob/master/classes/Model/Popup.php#L229

image

Additional context

Upon debugging, I discovered that some fields are left where the $value is false. So, during the check for if the $field is false, it passes the not empty check leading the code to go to the $field['private'] check which throws this error since $field is false.
field-debugging

@danieliser
Copy link
Member

Simplest solutions might be

Change && ! empty( $value ) to && isset( $value ) which would allow a false.

Or simply check that $field is an array before using it as one.

Or both.

@fpcorso
Copy link
Contributor Author

fpcorso commented Aug 20, 2020

@danieliser For the empty check, I think the very point of it is this use case. If a field no longer exists and there is a value, pass it through.

So, in that case, I think your solution of changing the empty to an isset is probably the right choice. I'll review the code and debug a bit more to make sure that change doesn't break anything. If not, I'll commit that.

@fpcorso fpcorso added this to the v1.12 milestone Aug 20, 2020
@danieliser
Copy link
Member

@fpcorso sounds good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants