PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
← All changes | src/behavior/scan/class-malware-deep-scan.php +7 -3 5.4.0 → 6.3.0 View file →
@@ -19,8 +19,9 @@
19 19 use PHP_CodeSniffer\Tokenizers\Tokenizer;
20 20 use PHP_CodeSniffer\Exceptions\RuntimeException;
21 21 use PHP_CodeSniffer\Exceptions\DeepExitException;
22 22 use PHP_CodeSniffer\Exceptions\TokenizerException;
23 +use WP_Filesystem_Base;
23 24
24 25 /**
25 26 * We need to verify the result to avoid false positive.
26 27 */
@@ -38,9 +39,9 @@
38 39 */
39 40 public function do_deep_scan( $file, $quick_found ) {
40 41 global $wp_filesystem;
41 42 // Initialize the WP filesystem, no more using 'file-put-contents' function.
42 - if ( empty( $wp_filesystem ) ) {
43 + if ( ! $wp_filesystem instanceof WP_Filesystem_Base ) {
43 44 require_once ABSPATH . '/wp-admin/includes/file.php';
44 45 WP_Filesystem();
45 46 }
46 47 $this->load_phpcodesniffer_needed();
@@ -81,10 +82,13 @@
81 82 ) ) {
82 83 unset( $tokens[ $k ] );
83 84 }
84 85 }
85 - $tokens = array_filter( $tokens );
86 - if ( empty( $tokens ) ) {
86 + $tokens = array_filter(
87 + $tokens,
88 + static fn( array $token ): bool => array() !== $token
89 + );
90 + if ( array() === $tokens ) {
87 91 // This mean the catch is comment, do nothing.
88 92 return false;
89 93 }
90 94 unset( $catch['text'] );