PHP: exec(svn commit) is not returning any errors nor working

后端 未结 3 595
醉话见心
醉话见心 2021-01-21 17:11

Currently I\'m writing out files with php into a directory, I add that directory (works fine), then when i try and do an svn commit its not working nor returning any kind of err

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-21 17:32

    Can you try throwing out the errors (read Mike's comment) status.

    ('cd '.$this->build_locations[$this->type].'; svn commit --username user --password pw; ls', $output, $error);
    if($error){
       print_r($error);
    }
    

    I would suggest to break the above into 3 separate commands for debugging purpose.

    Also, if $this-type can be manipulated by the users, then your code is vulnerable as they can pass something like: .; cat /etc/passwd, which becomes

    $tmp = exec('cd .; cat /etc/passwd; svn commit --username user --password pw; ls', $output);
    

提交回复
热议问题