checkSyntax
Definition
checkSyntax($patch_url)
test_it.php, line 286
Description
Checky syntax of files that are patched with patch at patch_url. Syntax is checked with php -l
Parameters
$patch_url patch url from which files that need checking are read
Code
<?php
function checkSyntax($patch_url) {
global $bins;
$patch = file_get_contents($patch_url, FALSE);
$line = strtok($patch, "\n");
$test_status = TRUE;
$msg = '';
while ($line !== false) {
if(preg_match('/^(Index: )(.*)/',$line, $matches)) {
$files_to_check[] = $matches[2];
}
$line = strtok("\n");
}
foreach($files_to_check as $i => $file) {
$exec_cmd = $bins['phpExec'] . " -l -f $file";
$output = null;
exec($exec_cmd, $output, $status);
if ($status != 0) {
$test_status = FALSE;
$msg .= implode($output, "<br>");
}
}
if (!$test_status) {
return terminateTesting(1, '<strong><br>Syntax error: <br>' . $msg . '</strong>');
}
return $test_status;
}
?> 