Skip to content

Commit e1f53ca

Browse files
committed
fixed shell escaping
1 parent 5a59478 commit e1f53ca

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/LaunchDarkly/EventProcessor.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,19 @@ protected function flush() {
7272

7373
private function createArgs($payload) {
7474
$scheme = $this->_ssl ? "https://" : "http://";
75-
$args = " -v -X POST";
75+
$args = " -X POST";
7676
$args.= " -H 'Content-Type: application/json'";
77-
$args.= " -H 'Authorization: api_key " . $this->_apiKey . "'";
77+
$args.= " -H " . escapeshellarg("Authorization: api_key " . $this->_apiKey);
7878
$args.= " -H 'User-Agent: PHPClient/" . LDClient::VERSION . "'";
7979
$args.= " -H 'Accept: application/json'";
80-
$args.= " -d '" . $payload . "'";
81-
$args.= " " . $scheme . $this->_host . ":" . $this->_port . "/api/events/bulk";
80+
$args.= " -d " . escapeshellarg($payload);
81+
$args.= " " . escapeshellarg($scheme . $this->_host . ":" . $this->_port . "/api/events/bulk");
8282
return $args;
8383
}
8484

8585
private function makeRequest($args) {
86-
error_log("curl args: " . $args);
87-
$cmd = "/usr/bin/env curl " . $args . ">> /tmp/curl.log 2>&1 &";
88-
$out = shell_exec($cmd);
86+
$cmd = "/usr/bin/env curl " . $args . ">> /dev/null 2>&1 &";
87+
shell_exec($cmd);
8988
return true;
9089
}
9190

0 commit comments

Comments
 (0)