loduis / teamwork.com-project-management

PHP API for Teamwork.com
https://developer.teamwork.com/
MIT License
70 stars 59 forks source link

camelizeObject must be of type array, object given #42

Closed alexscott64 closed 6 years ago

alexscott64 commented 6 years ago

Hi, it appears that sometimes, teamwork will fail with the following error when inserting a task into a task list:

PHP Fatal error:  Uncaught TypeError: Argument 1 passed to TeamWorkPm\\Response\\JSON::camelizeObject() must be of the type array, object given, called in 
/site/vendor/myabakus/teamworkpm/src/Response/JSON.php on line 91 and defined in /site/vendor/myabakus/teamworkpm/src/Response/JSON.php:128

Stack trace:
#0 /site/vendor/myabakus/teamworkpm/src/Response/JSON.php(91): TeamWorkPm\\Response\\JSON::camelizeObject(Object(stdClass))
#1 /site/vendor/myabakus/teamworkpm/src/Rest.php(97): TeamWorkPm\\Response\\JSON->parse('{"STATUS":"OK",...', Array)
#2 /site/vendor/myabakus/teamworkpm/src/Rest.php(157): TeamWorkPm\\Rest->execute('GET', 'authenticate', NULL)
#3 /site/vendor/myabakus/teamworkpm/src/Account.php(38): TeamWorkPm\\Rest->get('authenticate')
#4 /site/vendor/myabakus/teamworkpm/src/Auth.php(18): TeamWorkPm\\Account->authenticate()
#5 /site/vendor/myabakus/teamworkpm/src/Response/JSON.php on line 128, referer: https://site.com/teamwork_request

I have a valid key that works, and like I said I usually have no issues adding to a task list. It just appears sometimes. Anyone have any idea on how to solve it?

Biegalski-LLC commented 6 years ago

I get this for every request now

simonschaufi commented 6 years ago

Could you share a test script so that I can also test it with my own account? Or even better: make a PR and fix it ;)

Biegalski-LLC commented 6 years ago

For reference, I am able to replicate this error using the example script on the main repo page. https://github.com/loduis/teamwork.com-project-management

Biegalski-LLC commented 6 years ago

Pull request made.

https://github.com/loduis/teamwork.com-project-management/pull/43

simonschaufi commented 6 years ago

thanx. merged.