Skip to content

Commit b8bdbf5

Browse files
author
Felix Arntz
committed
Fix possible PHP notice.
1 parent 157252d commit b8bdbf5

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

wpengine-phpcompat.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@ function start_test() {
9595

9696
$wpephpc = new WPEPHPCompat( dirname( __FILE__ ) );
9797

98+
$test_data = array();
9899
foreach ( array( 'test_version', 'only_active' ) as $key ) {
99100
if ( isset( $_POST[ $key ] ) ) {
100-
$$key = sanitize_text_field( $_POST[ $key ] );
101+
$test_data[ $key ] = sanitize_text_field( $_POST[ $key ] );
101102
}
102103
}
103104

@@ -106,14 +107,16 @@ function start_test() {
106107
// Make sure we clean up after the last test.
107108
$wpephpc->clean_after_scan();
108109

109-
$test_version = sanitize_text_field( $_POST['test_version'] );
110-
$only_active = sanitize_text_field( $_POST['only_active'] );
111-
112110
// Fork so we can close the connection.
113-
$this->fork_scan( $test_version, $only_active );
111+
$this->fork_scan( $test_data['test_version'], $test_data['only_active'] );
114112
} else {
115-
$wpephpc->test_version = $test_version;
116-
$wpephpc->only_active = $only_active;
113+
if ( isset( $test_data['test_version'] ) ) {
114+
$wpephpc->test_version = $test_data['test_version'];
115+
}
116+
117+
if ( isset( $test_data['only_active'] ) ) {
118+
$wpephpc->only_active = $test_data['only_active'];
119+
}
117120

118121
$wpephpc->start_test();
119122
}

0 commit comments

Comments
 (0)