Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It doesn't work #3

Closed
adrianvmois opened this issue Mar 17, 2014 · 3 comments
Closed

It doesn't work #3

adrianvmois opened this issue Mar 17, 2014 · 3 comments

Comments

@adrianvmois
Copy link

when initiating ZendeskAPI object it gives an error
$client = new ZendeskAPI($subdomain, $username);

Here is the error:

Catchable fatal error: Argument 1 passed to Zendesk\API\Search::search() must be an array, object given, called in /Webserver/htdocs/project/vendor/zendesk/zendesk_api_client_php/src/Zendesk/API/Client.php on line 90 and defined in /Webserver/htdocs/project/vendor/zendesk/zendesk_api_client_php/src/Zendesk/API/Search.php on line 13

If I comment $this->search = new Search($this); on the line 90 of the file vendor/zendesk/zendesk_api_client_php/src/Zendesk/API/Client.php it starts to work.

@kinyat
Copy link

kinyat commented Mar 19, 2014

It should be something like this.

use Zendesk\API\Client as ZendeskAPI;

$api_client = new ZendeskAPI($subdomain, $username);
$api_client->setAuth('token', $token);
$search_query = 'name:"ORG_NAME" type:"organization"';
$result = $api_client->search(array('query' => $search_query));

@joeelizondo
Copy link
Contributor

I'm experiencing this same issue in production, maybe its a php version issue? I'm using 5.3.2. But no @door999mo, the error is thrown on the line $api_client = new ZendeskAPI($subdomain, $username); when instantiating the client. So it would never get to your other code. Its like it's trying to use the search function in the Search class as a constructor rather than using the ClientAbstract class' constructor. Very weird. I didn't have a problem with this on my slightly newer php 5.3.10 on my dev environment which leads me to believe it might be an issue in php? A fix for this would be very helpful.

I think this is the issue http://stackoverflow.com/questions/217618/construct-vs-sameasclassname-for-constructor-in-php

joeelizondo added a commit to joeelizondo/zendesk_api_client_php that referenced this issue May 3, 2014
joeelizondo added a commit to joeelizondo/zendesk_api_client_php that referenced this issue May 3, 2014
devarispbrown added a commit that referenced this issue Jun 5, 2014
Issue #3: Adds compatibility with PHP versions prior to 5.3.3
@sbkinney
Copy link

The fix @joeelizondo contributed was merged on June 5th. I'm going to close this out. Thanks everyone!

shanitang pushed a commit that referenced this issue Feb 9, 2015
@RaFeNiX RaFeNiX mentioned this issue Nov 12, 2015
lyrixx pushed a commit to lyrixx/zendesk_api_client_php that referenced this issue Jun 24, 2019
Issue zendesk#3: Adds compatibility with PHP versions prior to 5.3.3
lyrixx pushed a commit to lyrixx/zendesk_api_client_php that referenced this issue Jun 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants