diff --git a/src/Client.php b/src/Client.php index 3064342..bd03c67 100644 --- a/src/Client.php +++ b/src/Client.php @@ -1280,7 +1280,7 @@ public function execCreate($container, $cmd, $tty = false, $stdin = false, $stdo 'AttachStdin' => !!$stdin, 'AttachStdout' => !!$stdout, 'AttachStderr' => !!$stderr, - 'User' => $user, + 'User' => (string) $user, 'Privileged' => !!$privileged, ) )->then(array($this->parser, 'expectJson')); diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 8f3ff1b..7a06f78 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -655,6 +655,15 @@ public function testExecCreateStringCommand() $this->expectPromiseResolveWith($json, $this->client->execCreate(123, 'env')); } + public function testExecCreateWithNumericUser() + { + $json = array(); + $this->browser->expects($this->once())->method('post')->with('containers/123/exec', $this->anything(), '{"Cmd":["env"],"Tty":false,"AttachStdin":false,"AttachStdout":true,"AttachStderr":true,"User":"1000","Privileged":false}')->willReturn(\React\Promise\resolve($this->createResponseJson($json))); + $this->parser->expects($this->once())->method('expectJson')->willReturn($json); + + $this->expectPromiseResolveWith($json, $this->client->execCreate(123, array('env'), false, false, true, true, 1000)); + } + public function testExecDetached() { $body = '';