{"action":"reopened","issue":{"url":"https://api.github.com/repos/LearningLocker/learninglocker/issues/493","labels_url":"https://api.github.com/repos/LearningLocker/learninglocker/issues/493/labels{/name}","comments_url":"https://api.github.com/repos/LearningLocker/learninglocker/issues/493/comments","events_url":"https://api.github.com/repos/LearningLocker/learninglocker/issues/493/events","html_url":"https://github.com/LearningLocker/learninglocker/issues/493","id":55274813,"number":493,"title":"State API returns 400 Bad Request when PUTing a JSON object","user":{"login":"garemoko","id":1363163,"avatar_url":"https://avatars.githubusercontent.com/u/1363163?v=3","gravatar_id":"","url":"https://api.github.com/users/garemoko","html_url":"https://github.com/garemoko","followers_url":"https://api.github.com/users/garemoko/followers","following_url":"https://api.github.com/users/garemoko/following{/other_user}","gists_url":"https://api.github.com/users/garemoko/gists{/gist_id}","starred_url":"https://api.github.com/users/garemoko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garemoko/subscriptions","organizations_url":"https://api.github.com/users/garemoko/orgs","repos_url":"https://api.github.com/users/garemoko/repos","events_url":"https://api.github.com/users/garemoko/events{/privacy}","received_events_url":"https://api.github.com/users/garemoko/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/LearningLocker/learninglocker/labels/priority:medium","name":"priority:medium","color":"eb6420"},{"url":"https://api.github.com/repos/LearningLocker/learninglocker/labels/status:unmerged","name":"status:unmerged","color":"eb6420"},{"url":"https://api.github.com/repos/LearningLocker/learninglocker/labels/type:bug","name":"type:bug","color":"e11d21"}],"state":"open","locked":false,"assignee":{"login":"ryansmith94","id":3045513,"avatar_url":"https://avatars.githubusercontent.com/u/3045513?v=3","gravatar_id":"","url":"https://api.github.com/users/ryansmith94","html_url":"https://github.com/ryansmith94","followers_url":"https://api.github.com/users/ryansmith94/followers","following_url":"https://api.github.com/users/ryansmith94/following{/other_user}","gists_url":"https://api.github.com/users/ryansmith94/gists{/gist_id}","starred_url":"https://api.github.com/users/ryansmith94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryansmith94/subscriptions","organizations_url":"https://api.github.com/users/ryansmith94/orgs","repos_url":"https://api.github.com/users/ryansmith94/repos","events_url":"https://api.github.com/users/ryansmith94/events{/privacy}","received_events_url":"https://api.github.com/users/ryansmith94/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/LearningLocker/learninglocker/milestones/14","html_url":"https://github.com/LearningLocker/learninglocker/milestones/1.3.4","labels_url":"https://api.github.com/repos/LearningLocker/learninglocker/milestones/14/labels","id":978208,"number":14,"title":"1.3.4","description":"","creator":{"login":"ryansmith94","id":3045513,"avatar_url":"https://avatars.githubusercontent.com/u/3045513?v=3","gravatar_id":"","url":"https://api.github.com/users/ryansmith94","html_url":"https://github.com/ryansmith94","followers_url":"https://api.github.com/users/ryansmith94/followers","following_url":"https://api.github.com/users/ryansmith94/following{/other_user}","gists_url":"https://api.github.com/users/ryansmith94/gists{/gist_id}","starred_url":"https://api.github.com/users/ryansmith94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryansmith94/subscriptions","organizations_url":"https://api.github.com/users/ryansmith94/orgs","repos_url":"https://api.github.com/users/ryansmith94/repos","events_url":"https://api.github.com/users/ryansmith94/events{/privacy}","received_events_url":"https://api.github.com/users/ryansmith94/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":12,"state":"open","created_at":"2015-02-13T10:29:50Z","updated_at":"2015-02-25T14:59:14Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-01-23T12:08:17Z","updated_at":"2015-02-25T14:59:14Z","closed_at":null,"body":"**Version**\r\nhttp://lrs.learninglocker.net/lrs/\r\n\r\n**Steps to reproduce the bug**\r\nUsing TinCanJS, PUT a document of type application/json twice in a row without using etags. Use the following document contents:\r\n\r\n``` {\"location\":1,\"attemptDuration\":9083,\"attemptComplete\":false} ```\r\n\r\n**Expected behaviour**\r\nThe document should be updated returning 204 No Content. \r\n\r\n**Actual behaviour**\r\n400 Bad Request. ``` {\"error\":true,\"success\":false,\"message\":\"sha1() expects parameter 1 to be string, array given\",\"trace\":\"#0 [internal function]: Illuminate\\\\Exception\\\\Handler->handleError(2, 'sha1() expects ...', '\\/var\\/www\\/html\\/l...', 66, Array)\\n#1 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/app\\/models\\/DocumentAPI.php(66): sha1(Array)\\n#2 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/app\\/models\\/DocumentAPI.php(27): DocumentAPI->setSha(Array)\\n#3 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/app\\/models\\/DocumentAPI.php(126): DocumentAPI->putContent('{\\\"location\\\":1,\\\"...', 'application\\/jso...')\\n#4 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/app\\/locker\\/repository\\/Document\\/EloquentDocumentRepository.php(254): DocumentAPI->setContent(Array, 'PUT')\\n#5 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/app\\/locker\\/repository\\/Document\\/EloquentDocumentRepository.php(95): Locker\\\\Repository\\\\Document\\\\EloquentDocumentRepository->storeStateDoc('54c13edd66562fe...', Array, '2015-01-23T11:5...', 'PUT')\\n#6 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/app\\/controllers\\/xapi\\/DocumentController.php(94): Locker\\\\Repository\\\\Document\\\\EloquentDocumentRepository->store('54c13edd66562fe...', 'state', Array, '2015-01-23T11:5...', 'PUT')\\n#7 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/app\\/controllers\\/xapi\\/DocumentController.php(113): Controllers\\\\xAPI\\\\DocumentController->store()\\n#8 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/app\\/controllers\\/xapi\\/BaseController.php(37): Controllers\\\\xAPI\\\\DocumentController->update()\\n#9 [internal function]: Controllers\\\\xAPI\\\\BaseController->selectMethod()\\n#10 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/vendor\\/laravel\\/framework\\/src\\/Illuminate\\/Routing\\/Controller.php(231): call_user_func_array(Array, Array)\\n#11 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/vendor\\/laravel\\/framework\\/src\\/Illuminate\\/Routing\\/ControllerDispatcher.php(93): Illuminate\\\\Routing\\\\Controller->callAction('selectMethod', Array)\\n#12 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/vendor\\/laravel\\/framework\\/src\\/Illuminate\\/Routing\\/ControllerDispatcher.php(62): Illuminate\\\\Routing\\\\ControllerDispatcher->call(Object(Controllers\\\\xAPI\\\\StateController), Object(Illuminate\\\\Routing\\\\Route), 'selectMethod')\\n#13 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/vendor\\/laravel\\/framework\\/src\\/Illuminate\\/Routing\\/Router.php(962): Illuminate\\\\Routing\\\\ControllerDispatcher->dispatch(Object(Illuminate\\\\Routing\\\\Route), Object(Illuminate\\\\Http\\\\Request), 'Controllers\\\\\\\\xAP...', 'selectMethod')\\n#14 [internal function]: Illuminate\\\\Routing\\\\Router->Illuminate\\\\Routing\\\\{closure}()\\n#15 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/vendor\\/laravel\\/framework\\/src\\/Illuminate\\/Routing\\/Route.php(109): call_user_func_array(Object(Closure), Array)\\n#16 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/vendor\\/laravel\\/framework\\/src\\/Illuminate\\/Routing\\/Router.php(1028): Illuminate\\\\Routing\\\\Route->run(Object(Illuminate\\\\Http\\\\Request))\\n#17 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/vendor\\/laravel\\/framework\\/src\\/Illuminate\\/Routing\\/Router.php(996): Illuminate\\\\Routing\\\\Router->dispatchToRoute(Object(Illuminate\\\\Http\\\\Request))\\n#18 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/vendor\\/laravel\\/framework\\/src\\/Illuminate\\/Foundation\\/Application.php(776): Illuminate\\\\Routing\\\\Router->dispatch(Object(Illuminate\\\\Http\\\\Request))\\n#19 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/vendor\\/laravel\\/framework\\/src\\/Illuminate\\/Foundation\\/Application.php(746): Illuminate\\\\Foundation\\\\Application->dispatch(Object(Illuminate\\\\Http\\\\Request))\\n#20 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/vendor\\/asm89\\/stack-cors\\/src\\/Asm89\\/Stack\\/Cors.php(51): Illuminate\\\\Foundation\\\\Application->handle(Object(Illuminate\\\\Http\\\\Request), 1, true)\\n#21 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/vendor\\/laravel\\/framework\\/src\\/Illuminate\\/Session\\/Middleware.php(72): Asm89\\\\Stack\\\\Cors->handle(Object(Illuminate\\\\Http\\\\Request), 1, true)\\n#22 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/vendor\\/laravel\\/framework\\/src\\/Illuminate\\/Cookie\\/Queue.php(47): Illuminate\\\\Session\\\\Middleware->handle(Object(Illuminate\\\\Http\\\\Request), 1, true)\\n#23 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/vendor\\/laravel\\/framework\\/src\\/Illuminate\\/Cookie\\/Guard.php(51): Illuminate\\\\Cookie\\\\Queue->handle(Object(Illuminate\\\\Http\\\\Request), 1, true)\\n#24 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/vendor\\/stack\\/builder\\/src\\/Stack\\/StackedHttpKernel.php(23): Illuminate\\\\Cookie\\\\Guard->handle(Object(Illuminate\\\\Http\\\\Request), 1, true)\\n#25 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/vendor\\/laravel\\/framework\\/src\\/Illuminate\\/Foundation\\/Application.php(642): Stack\\\\StackedHttpKernel->handle(Object(Illuminate\\\\Http\\\\Request))\\n#26 \\/var\\/www\\/html\\/learninglocker\\/subdomains\\/live\\/public\\/index.php(49): Illuminate\\\\Foundation\\\\Application->run()\\n#27 {main}\"} ```\r\n\r\n**Server information**\r\nhttp://lrs.learninglocker.net/lrs/\r\n\r\n**Client information**\r\nOS: OS X\r\nBrowser: Chrome\r\n\r\n**Additional information**\r\n* Possibly related to https://github.com/LearningLocker/learninglocker/issues/491\r\n* Bug does not occur with content type application/octet-stream and content ```1```"}}