Created attachment 349343 [details] [diff] [review] Fix case where payload is an Array PUT requests to http://server/weave/0.3/user/keys/pubkey and http://server/weave/0.3/user/keys/privkey does not result in the storage of the keys in the DB (I'm using the SQLite backend). The PUT request contains a payload that is an array as described in the API. However, store_object() in weave_storage.inc assumes that the payload is either an object or a string and the following warning is generated: [Fri Nov 21 03:17:40 2008] [error] [client ::1] PHP Notice: Array to string conversion in /Users/anant/Code/weave/server/server/weave_storage.inc on line 437 A subsequent check on the store database reveals that the pubkey and privkey payloads are incorrectly stored as 'Array'. The fix attached adds a case where the payload is an Array and stores its JSON equivalent in the DB.
Odd. I would have expected that to decode to an object. Consolidated it down to if (is_object($payload) || is_array($payload))
Umm, I don't that would really work because the statement inside the if is: json_encode($payload()) "$payload()" doesn't make sense if $payload is an Array :)
it doesn't make sense if $payload is an object, either :) It's a typo and I've pulled it. Should just be json_encode($payload)