Skip to content

Commit 6a7cf67

Browse files
committed
fix: plugin check errors
1 parent 6f40b8a commit 6a7cf67

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

backend/app/Providers/AccessControlProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public function scanFile($command, $args)
218218
}
219219

220220
if (\count($this->scannedResult) > 0) {
221-
throw new PreCommandException(implode('. >> ', $this->scannedResult));
221+
throw new PreCommandException(wp_strip_all_tags(implode('. >> ', $this->scannedResult)));
222222
}
223223
}
224224

backend/app/Providers/FileEditValidator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ public function checkSyntax($content, $realFile)
3939
$wpError = (new PhpSyntaxChecker())->check($content, $realFile);
4040

4141
if ($wpError instanceof WP_Error) {
42-
throw new PreCommandException($wpError->get_error_message());
42+
$message = $wpError->get_error_message();
43+
44+
throw new PreCommandException(wp_strip_all_tags($message));
4345
}
4446
}
4547

backend/app/Providers/PhpSyntaxChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ public function check($content, $realFile)
2626
{
2727
$previousContent = file_get_contents($realFile);
2828

29+
// phpcs:disable WordPress.WP.AlternativeFunctions.file_system_operations_fopen, WordPress.WP.AlternativeFunctions.file_system_operations_fwrite, WordPress.WP.AlternativeFunctions.file_system_operations_fclose
2930
if (!is_writable($realFile)) {
3031
return new WP_Error('file_not_writable');
3132
}
3233

33-
// phpcs:disable WordPress.WP.AlternativeFunctions.file_system_operations_fopen, WordPress.WP.AlternativeFunctions.file_system_operations_fwrite, WordPress.WP.AlternativeFunctions.file_system_operations_fclose
3434
$f = fopen($realFile, 'w+');
3535

3636
if (false === $f) {

0 commit comments

Comments
 (0)