web - Why the statement exec("php -l $file", $error, $exit) set $exit = 5 while there's no error? -
the file exists. i'm validating syntax of file statement.
exec("php -l $file", $error, $exit); it supposed set $exit = 0 if there's no error. in other words, syntax in file right. in case, sets $exit 5 , $error empty array. wonder how case. in advance.
also, i'm using mamp. php5.3. $file hash string of file content. $code string of file content gotten file_get_contents() function. don't think $translatedfile , $error matter in question.
function validatesyntax($code,$translatedfile, &$error){ $translatedfile = $this->gettranslatedlanguagefile($translatedfile); $file = 'cache/'.md5(time()); file_put_contents( $file, $code); exec("php -l $file",$error,$exit); foreach($error $k=>$v){ $error[$k] = str_replace($file, $translatedfile, $v); } unlink($file); if($retcode==0)return true; return false; }
you quoting around of parameters, rather using quotes around command , passing last 2 arguments. looking for
exec("php -l $file", $error, $exit);
Comments
Post a Comment