Menu

#22 exec not checking return status

open
nobody
None
5
2010-01-18
2010-01-18
Anonymous
No

The calls to exec() use the one-argument form, and any tests are based on the return value of exec(), which is just the contents of the last line of any output, eg:

$ret = exec("blah blah");
if($ret!="") {
error_log("blah blah failed: $ret");
return false;
}
Better would be

exec("blah blah",$out=array(),$ret);
if($ret!=0) {
error_log("blah blah failed: $out");
return false;
}

Discussion


Log in to post a comment.