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

Php error on wp-admin / companies / settings page #2610

Closed
cisnerosebastian opened this issue Oct 9, 2023 · 1 comment · Fixed by #2631
Closed

Php error on wp-admin / companies / settings page #2610

cisnerosebastian opened this issue Oct 9, 2023 · 1 comment · Fixed by #2631
Assignees

Comments

@cisnerosebastian
Copy link

https://github.com/Automattic/WP-Job-Manager/blob/534d65f977901c87e3da743b64f59d40d21fd0c5/includes/admin/class-wp-job-manager-settings.php#L1092C25-L1092C25

I'm getting a

"NOTICE: PHP message: PHP Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array"

that is breaking the page there.

changing this

foreach ( $option['options'] as $key => $name ) {
				echo '<option value="' . esc_attr( $key ) . '" ' . selected( in_array( $key, $value, true ) ? $key : null, $key, false ) . '>' . esc_html( $name ) . '</option>';
			}

to this

foreach ( $option['options'] as $key => $name ) {
    $isSelected = is_array($value) && in_array($key, $value, true);
    echo '<option value="' . esc_attr( $key ) . '" ' . selected( $isSelected ? $key : null, $key, false ) . '>' . esc_html( $name ) . '</option>';
}

fixes the issue.

@thedebian thedebian assigned thedebian and unassigned thedebian Nov 8, 2023
@thedebian
Copy link
Contributor

Should be fixed by #2631

@thedebian thedebian self-assigned this Nov 8, 2023
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 a pull request may close this issue.

2 participants