Skip to content

Commit

Permalink
[Parser] Use function_exists to check that exec is disabled (Codecept…
Browse files Browse the repository at this point in the history
…ion#3886)

A better alternative to @exec
Thanks to https://github.com/mklemarczyk
  • Loading branch information
Naktibalda authored and bulzgkri committed Jun 16, 2017
1 parent 34a8837 commit ce62903
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Codeception/Lib/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ public static function validate($file)
if (empty($config['settings']['lint'])) { // lint disabled in config
return;
}
@exec("php -l " . escapeshellarg($file) . " 2>&1", $output, $code);
if (!isset($code)) {
//probably exec function is disabled #3324
if (!function_exists('exec')) {
//exec function is disabled #3324
return;
}
exec("php -l " . escapeshellarg($file) . " 2>&1", $output, $code);
if ($code !== 0) {
throw new TestParseException($file, implode("\n", $output));
}
Expand Down

0 comments on commit ce62903

Please sign in to comment.