note 48835 deleted from function.php-check-syntax by nlopess
| From: | nlopess@php.net | Date: | Thu, 08 Dec 2005 16:49:09 +0000 |
| Subject: | note 48835 deleted from function.php-check-syntax by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-99759@lists.php.net to get a copy of this message | ||
Note Submitter: Cainus
----
In PHP4,
if (!function_exists('php_check_syntax')){
function php_check_syntax($filename, &$errormessage){
$command = 'php -l ' . $filename;
$output = shell_exec($command);
if (strpos($output, 'No syntax errors detected in') !== false){
$errormessage = '';
return(true);
} else {
$errormessage = $output;
return(false);
}
}
}
// Note: this function will have the same security constraints as shell_exec for a given system