note 58478 deleted from function.php-check-syntax by nlopess
| From: | nlopess@php.net | Date: | Thu, 08 Dec 2005 16:49:36 +0000 |
| Subject: | note 58478 deleted from function.php-check-syntax by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-99761@lists.php.net to get a copy of this message | ||
Note Submitter: virtuall at virtuall dot info
----
According to the NEWS file, this function has been removed since 5.1/5.0.5
But you can use this one:
<?php
if (!function_exists('php_check_syntax')) {
function php_check_syntax($file, &$error) {
if (isset($_SERVER['_'])) {
$php = $_SERVER['_']; //not sure about this
} else {
$php = 'php';
};
$result = shell_exec($php.' -l '.$file);
if (strpos($result, 'No syntax errors detected') === 0) {
include_once $file; //remove this if you wish
return 1;
} else {
$result = str_replace('Errors parsing '.$file, '', $result);
$error = trim($result, " \n\r\t");
return 0;
};
};
};
?>