php-trello-api
php-trello-api copied to clipboard
Checlist item state always true
Because of this line:
https://github.com/cdaguerre/php-trello-api/blob/b1205d9ac9b24df03c2db5aa9a8c7418d28c0b78/lib/Trello/Model/Checklist.php#L245
$this->data['checkItems'][$key]['state'] = in_array($item['state'], array(true, 'complete', 'true'));
Should be:
$this->data['checkItems'][$key]['state'] = in_array($item['state'], array(true, 'complete', 'true'), true);
The problem is that both 'incomplete' == true and 'complete' == true evaluate to true. The strict mode is required (in_array, third parameter). To me it seems even unneeded to have this kind of in_array check. The values are just 'incomplete' and 'complete', right? Can't we trust on that?
@ilkka-rautiainen I think so. Would you mind opening a PR?
Probably not as I stopped using the library as it was slow.
pe 29. tammikuuta 2016 19.03 Christian Daguerre [email protected] kirjoitti:
@ilkka-rautiainen https://github.com/ilkka-rautiainen I think so. Would you mind opening a PR?
— Reply to this email directly or view it on GitHub https://github.com/cdaguerre/php-trello-api/issues/21#issuecomment-176862594 .
Ok thanks for reporting anyway. This client uses guzzle for http requests and only adds a tiny bit of code so I'd be interested if you identified any specific bottlenecks...
Actually I found that it could have been the trello itself that was slow..
pe 29. tammikuuta 2016 19.13 Christian Daguerre [email protected] kirjoitti:
Ok thanks for reporting anyway. This client uses guzzle for http requests and only adds a tiny bit of code so I'd be interested if you identified any specific bottlenecks...
— Reply to this email directly or view it on GitHub https://github.com/cdaguerre/php-trello-api/issues/21#issuecomment-176867724 .
I think that it's very fast. Probably you have issues on your application reaching Trello's servers
Or actually the working principle is heavy, for example to update one checklist item you have to first fetch the checklist itself.
pe 29. tammikuuta 2016 19.14 Ilkka Rautiainen [email protected] kirjoitti:
Actually I found that it could have been the trello itself that was slow..
pe 29. tammikuuta 2016 19.13 Christian Daguerre [email protected] kirjoitti:
Ok thanks for reporting anyway. This client uses guzzle for http requests and only adds a tiny bit of code so I'd be interested if you identified any specific bottlenecks...
— Reply to this email directly or view it on GitHub https://github.com/cdaguerre/php-trello-api/issues/21#issuecomment-176867724 .
Maybe you could open a new issue so we can discuss this.
I've submitted a PR to resolve this issue.