-
Notifications
You must be signed in to change notification settings - Fork 73
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
Fatal error: Call to a member function get_name() on a non-object in /xero.php on line 784 #4
Comments
Could it be related to the issue discussed at http://github.com/thinktree/PHP-Xero/issues/closed#issue/1 ? Please check out that thread and let me know if this could be relevant to your case... |
It would be easier to prevent this issue if there was a public method to check the private variables in the Xero class: consumer, token, and signature_method. At the moment you can't detect whether you have a valid xero object or not before you start making queries (at least I can't get the constructor's return false statements). Here's a patch I wrote: diff --git a/xero.php b/xero.php index 3afa43d..9782747 100644 --- a/xero.php +++ b/xero.php @@ -329,6 +329,13 @@ class Xero { return $this->$name(); } + public function verify() { + if ( !is_object($this->consumer) || !is_object($this->token) || !is_object($thi + return false; + } + return true; + } + } //END Xero class @@ -1317,4 +1324,4 @@ class ArrayToXML public static function isAssoc( $array ) { return (is_array($array) && 0 !== count(array_diff_key($array, array_keys(array_keys($ } -} \ No newline at end of file +} I've tested it in cases where public cert is empty or not. |
tested this - necessary for the drupal module to do some checks of validity. |
was going to add the diff above but part of the message has been chopped off. are you able to re-post but maybe wrap the code? |
Throw an exception when method does not exist
For some reason that is all i get whenever i try and call anything from the api. What am i doing wrong? I am running PHP version 5.2.4-2
The text was updated successfully, but these errors were encountered: