Permalink
Browse files

Fix issue where calling methods with positional parameters causes par…

…ameters to be lost if the first is null (e.g. $api->findLeads(null, 'id', 'asc', 50))
  • Loading branch information...
1 parent 5248e81 commit f8bde553fa3a38090ba056f8a0213e6aa7373e4d @MasonM MasonM committed Jul 13, 2012
Showing with 6 additions and 8 deletions.
  1. +6 −8 NutshellApi.php
View
@@ -77,14 +77,12 @@ function __destruct() {
*/
public function __call($name, $args) {
$params = null;
- if (isset($args[0])) {
- if (is_array($args[0])) {
- // e.g. $api->getLead(array('leadId' => 11))
- $params = $args[0];
- } else {
- // e.g. $api->getLead(11)
- $params = $args;
- }
+ if (count($args) === 1 && is_array($args[0])) {
+ // e.g. $api->getLead(array('leadId' => 11))
+ $params = $args[0];
+ } else {
+ // e.g. $api->getLead(11)
+ $params = $args;
}
return $this->call($name, $params);
}

0 comments on commit f8bde55

Please sign in to comment.