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

Fatal error: Call to a member function get_name() on a non-object in /xero.php on line 784 #4

Open
unifonenz opened this issue Jul 28, 2010 · 4 comments

Comments

@unifonenz
Copy link

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

@drpitman
Copy link
Owner

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...

@mradcliffe
Copy link

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.

@Br3nda
Copy link

Br3nda commented Mar 28, 2011

tested this - necessary for the drupal module to do some checks of validity.
please merge :-)

@unifonenz
Copy link
Author

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?

mradcliffe referenced this issue in mradcliffe/PHP-Xero Jul 22, 2012
Throw an exception when method does not exist
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