Skip to content

Commit acde23e

Browse files
Update index.php to check for shell_exec availability
1 parent 1f75d01 commit acde23e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

index.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
$tempRulesFile = sys_get_temp_dir() . '/' . uniqid() . '.xml';
2424
file_put_contents($tempRulesFile, $rules ?: 'rulesets/java/quickstart.xml'); // Fallback to basic rules if none provided
2525

26+
if (!function_exists('shell_exec')) {
27+
http_response_code(500);
28+
echo json_encode(['error' => 'shell_exec is disabled']);
29+
exit;
30+
}
31+
2632
// Run PMD via shell_exec
2733
$pmdOutput = shell_exec('pmd check -d ' . escapeshellarg($tempCodeFile) . ' -R ' . escapeshellarg($tempRulesFile) . ' -f json 2>&1');
2834

0 commit comments

Comments
 (0)